简体   繁体   中英

Debian 8: Installed Python 2.7.13 But No Pip; Packages Install to Wrong Path

I am running Debain 8 Jessie and have installed python 2.7.13 into /usr/local/bin .

I do not have a new pip installed, I am still using the pip located at /usr/bin/ . Any time I install a package using pip , they are installed to the dist-packages location of my new python install:

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

Question

How do I get my pip installs to permanently install in /usr/lib/python2.7/dist-packages ? What is even weirder, is that although these packages are installing to a location seemingly setup by my new install, I cannot import whatever I download when I am using python2.7.13 via /usr/local/bin/python .

PATH

/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin:/bin:

Better Yet

How do I just get my python2.7.13 install to see the installed packages from pip?

Run this:

import sys
for p in sys.path: 
    print p     # or print(p) if you prefer. 

Look for /usr/lib/python2.7

if not you'll want to

export PYTHONPATH=/usr/local/lib/python2.7:/usr/lib/python2.7 

in .bashrc or in a special (host-wide) script in /etc/profile.d/

If /usr/lib/python2.7/

Depending on the difference between your "stock" version and 2.7.13, you might not want to put stuff in /usr/lib/python2.7. On my system I'd really want to avoid any cross contamination, but that's something I'm a bit picky about.

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