Is it possible? When installing pip, install the python packages inside my $HOME folder. (for example, I want to install mercurial, using pip, but inside $HOME instead of /usr/local)
I’m with a mac machine and just thought about this possibility, instead of “polluting” my /usr/local, I would use my $HOME instead.
PEP370 is exactly about this. Is just creating a ˜/.local and do a pip install package enough to make these packages to be installed only at my $HOME folder?
While you can use a
virtualenv, you don’t need to. The trick is passing the PEP370--userargument to thesetup.pyscript. With the latest version ofpip, one way to do it is:This should result in the
hgscript being installed in$HOME/.local/bin/hgand the rest of the hg package in$HOME/.local/lib/pythonx.y/site-packages/.Note, that the above is true for Python 2.6. There has been a bit of controversy among the Python core developers about what is the appropriate directory location on Mac OS X for PEP370-style
userinstallations. In Python 2.7 and 3.2, the location on Mac OS X was changed from$HOME/.localto$HOME/Library/Python. This might change in a future release. But, for now, on 2.7 (and 3.2, ifhgwere supported on Python 3), the above locations will be$HOME/Library/Python/x.y/bin/hgand$HOME/Library/Python/x.y/lib/python/site-packages.