报错信息:× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [41 lines of output]
running egg_info
creating /private/var/folders/l9/f9rjm65s07bdf55y5xyk9f2c0000gn/T/pip-pip-egg-info-o3ic4gdp/progressbar.egg-info
writing /private/var/folders/l9/f9rjm65s07bdf55y5xyk9f2c0000gn/T/pip-pip-egg-info-o3ic4gdp/progressbar.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/l9/f9rjm65s07bdf55y5xyk9f2c0000gn/T/pip-pip-egg-info-o3ic4gdp/progressbar.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/l9/f9rjm65s07bdf55y5xyk9f2c0000gn/T/pip-pip-egg-info-o3ic4gdp/progressbar.egg-info/top_level.txt
writing manifest file '/private/var/folders/l9/f9rjm65s07bdf55y5xyk9f2c0000gn/T/pip-pip-egg-info-o3ic4gdp/progressbar.egg-info/SOURCES.txt'
reading manifest file '/private/var/folders/l9/f9rjm65s07bdf55y5xyk9f2c0000gn/T/pip-pip-egg-info-o3ic4gdp/progressbar.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.txt'
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/private/var/folders/l9/f9rjm65s07bdf55y5xyk9f2c0000gn/T/pip-install-k6x5gkip/progressbar_fd7cafa1bb454e40a17d3bafdba1dcb8/setup.py", line 19, in
setup(
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/init.py", line 117, in setup
return distutils.core.setup(**attrs)
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 183, in setup
return run_commands(dist)
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 199, in run_commands
dist.run_commands()
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
self.run_command(cmd)
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/dist.py", line 999, in run_command
super().run_command(command)
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
cmd_obj.run()
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 312, in run
self.find_sources()
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 320, in find_sources
mm.run()
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 546, in run
self.prune_file_list()
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/command/sdist.py", line 162, in prune_file_list
super().prune_file_list()
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/_distutils/command/sdist.py", line 380, in prune_file_list
base_dir = self.distribution.get_fullname()
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/_core_metadata.py", line 267, in get_fullname
return _distribution_fullname(self.get_name(), self.get_version())
File "/opt/homebrew/Caskroom/miniconda/base/envs/ML/lib/python3.10/site-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname
canonicalize_version(version, strip_trailing_zero=False),
TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Python 版本:3.10.0
安装网站:https://pypi.org/project/spam/0.7.0.1/
这个错误 TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' 主要是由于 setuptools 版本的问题,特别是与版本解析函数 canonicalize_version() 的兼容性问题。这个问题通常会出现在较新的 setuptools 版本和旧的 Python 环境中。
解决方法:pip install setuptools==64.0.0