Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip: How to install into /usr/local

If I run pip install as root, I want it to install into /usr/local.

This works on some linux systems, but on others it does not.

How can I force pip to install into my desired directory?

A solution using a config file would be preferred to a solution with a command line argument.

like image 814
guettli Avatar asked Mar 05 '15 09:03

guettli


Video Answer


1 Answers

You should create config file $HOME/.config/pip/pip.conf and add option:

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

And add this directory to your PYTHONPATH if it isn't in. 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

like image 185
Eugene Soldatov Avatar answered Oct 25 '22 14:10

Eugene Soldatov