Pip: How to install in / usr / local

If I run pip install as root, I want it to be installed in /usr/local .

This works on some Linux systems, but not on others.

How can I get pip to install in the correct directory?

A solution using a configuration file would be preferable to a solution with a command line argument.

+5
source share
1 answer

You must create the $ HOME / .config / pip / pip.conf configuration file and add the parameter:

 [global] target = /usr/local/lib/python2.7/site-packages 

And add this directory to your PYTHONPATH if it is missing. Add to $ HOME / .bashrc:

 export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages 

https://pip.pypa.io/en/latest/user_guide.html#config-file https://pip.pypa.io/en/latest/reference/pip_install.html#cmdoption-t

+6
source

Source: https://habr.com/ru/post/1214724/


All Articles