更新pip和setuptools==66.0后,pip停止工作并响应所有尝试调用它,如下所示:
Traceback (most recent call last):
File "/usr/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3249, in <module>
def _initialize_master_working_set():
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3223, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 3261, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 619, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 632, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 1044, in __init__
self.scan(search_path)
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 1077, in scan
self.add(dist)
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 1096, in add
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 2631, in hashcmp
self.parsed_version,
File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 2685, in parsed_version
raise packaging.version.InvalidVersion(f"{str(ex)} {info}") from None
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '0.23ubu ntu1' (package: distro-info)
谢谢
1条答案
按热度按时间qaxu7uf21#
这是由setuptools开发人员设计的,请在www.example.com上查看一些评论https://github.com/pypa/setuptools/issues/3772#issuecomment-1384342813。
简而言之,它已经被删除了,以强制执行严格的语义版本控制。如果你不能升级版本控制到语义版本控制兼容,请将setuptools固定到版本〈66。
下面是Python的版本规范:https://peps.python.org/pep-0440/