我的环境是OSX High Sierra 10.13.6。
➜ python
Python 3.7.2 (default, Jan 13 2019, 12:50:15)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
➜ python3
Python 3.7.2 (default, Jan 13 2019, 12:50:15)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
如果我输入了pip,则会引发错误。
/usr/local/opt/python/libexec/bin/pip:6: UserWarning: Unbuilt egg for Unknown [unknown version] (/usr/local/lib/python3.7/site-packages)
from pkg_resources import load_entry_point
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 581, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 898, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 789, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 19.0.1 (/usr/local/lib/python3.7/site-packages), Requirement.parse('pip==18.1'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/opt/python/libexec/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3126, in <module>
@_call_aside
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3110, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3139, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 596, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 784, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==18.1' distribution was not found and is required by the application
我尝试了pip install -U setuptools
,但是它抛出了同样的错误。
还与get-pip.py重新安装,它不起作用。
也许python路径在我的系统中是扭曲的。
如何完全删除pip和python并重新安装?
谢谢。