简体   繁体   中英

Stop pip installing dependancies already installed using apt-get

How do I make sure packages installed using pip don't install dependancies already installed using apt-get ?

For example, on Ubuntu you can install the package Numpy using apt-get install python-numpy . Which gets installed to:

usr/local/lib/python2.7/dist-packages 

I've noticed that when I install a package that requires numpy using pip for example, pip install scipy instead of skipping the numpy dependancy it installs again to a different location.

/usr/lib/python2.7/dist-packages

What pip should do is skip any python packages installed globally, right?

In key here is to prevent multiple package managers to install into the same directories.

One strategy is to create a virtualenv that is aware of the package of its parent interpreter. This can be done by using the --system-site-packages option.

virtualenv -p /usr/bin/python --system-site-packages py27
source py27/bin/activate

This environment will not be empty by default. You may want to compare /usr/bin/python -m pip list and python -m pip list .

See also this question


For many (scientific) packages there are also wheels available on pypi. Wheels are already binary and thus need no further compilation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM