解决python升级导致pip install 报错

最近要处理一个excel数据,发现pip安装依赖库报错。

File "/usr/local/python3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/python3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3030, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/python3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 661, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/python3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 674, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/python3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 853, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==20.0.2' distribution was not found and is required by the application

 

解决方案:

1、先查看以下目录/usr/local/lib/python3.8/site-packages/  查看对应的pip版本,

2、然后修改pip,代码如下:

vi /usr/local/bin/pip

将pip==20.0.2修改成pip==对应版本,就可以了

 

你可能感兴趣的:(Mac)