pip告诉我,我应该更新。 我启动命令后
pip install --upgrade pip
当我使用
pip3 --version
我收到以下错误:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 635, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 943, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 834, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 8.1.1 (/usr/lib/python3/dist-packages), Requirement.parse('pip==10.0.1'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
@_call_aside
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2940, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 637, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 650, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 829, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==10.0.1' distribution was not found and is required by the application
我尝试再次安装pip:
sudo apt install python3-pip
但它告诉我
python3-pip is already the newest version (8.1.1-2ubuntu0.4).
我该如何解决此问题? 谢谢。
答案 0 :(得分:0)
尝试重新安装它。
apt install --reinstall python3-pip
答案 1 :(得分:0)
由于仍然没有真正的答案... 我在Linux(CentOS 7)上也遇到了这个问题,并设法解决了这个问题。 转到主文件夹。
$ cd ~
如果您需要最新版本:
$ pip3 install --user --upgrade pip
如果您需要特定版本(例如问题中的内容)
$ pip3 install --user pip==10.0.1