如何更改pip的安装路径

时间:2018-09-28 18:21:12

标签: python pip

在以下命令中使用时,出现这些错误

  

sudo pip安装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

然后我尝试使用pip版本并获得以下输出

  

pip --version

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

1 个答案:

答案 0 :(得分:0)

创建环境变量PIP_TARGET可以帮助或编辑pip.conf文件。 另一种方法是使用-t

ROOTDRIVE