Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install python modules on a per project basis, rather than system wide?

I am trying to define a process for migrating django projects from my development server to my production server using git, and it's driving me crazy that distutils installs python modules system-wide. I've read the documentation but unless I'm missing something it seems to be mostly about how to change the installation directory. I need to be able to use different versions of the same module in different projects running on the same server, and deploy projects from git without having to download and install dependencies.

tl;dr: I need to know how to install python modules, using distutils, into my project's source tree for version control without compromising other projects using different versions of the same module.

I'm new to python, so I apologize in advance if this is common knowledge.

like image 227
Parker Ault Avatar asked Feb 25 '23 11:02

Parker Ault


1 Answers

Besides the already mentioned virtualenv which is a good option but has the potential drawback of requiring a third-party module, Distutils itself has options to install modules into arbitrary locations. In particular, there is the home scheme which allows you to "build and maintain a personal stash of Python modules". It's described in the Python documentation set here.

like image 59
Ned Deily Avatar answered Apr 27 '23 01:04

Ned Deily