简体   繁体   中英

How to change the install path of pip

when used below command I get these errors

sudo pip install sqlalchemy

Traceback (most recent call last):
File "/usr/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 
3049, in <module>
@_call_aside
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 
3033, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 
3062, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 
660, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 
673, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
 File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", 
line 858, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==9.0.3' distribution was 
not found and is required by the application

I then tried for pip version and got the below output

pip --version

pip 9.0.3 from /usr/lib/python3.4/dist-packages (python 3.4)

Creating environment variable PIP_TARGET can help or edit pip.conf file. Another way is to use -t

sudo pip install sympy -t /path

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