python3:用pip安装第三方库时报错Command "python setup.py egg_info" failed with error code的解决
一,执行安装第三方库时报错:
[lhdop@blog ~]$ pip3 install backgroundremover
...
Downloading https://files.pythonhosted.org/packages/e3/7d/3d61160836e49f40913741c464f119551c15ed371c1d91ea50308495b93b/numba-0.53.1.tar.gz (2.2MB) 100% |████████████████████████████████| 2.2MB 686kB/s Complete output from command python setup.py egg_info: WARNING: The wheel package is not available. ERROR: 'pip wheel' requires the 'wheel' package. To fix this, run: pip install wheel Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/setuptools/installer.py", line 128, in fetch_build_egg subprocess.check_call(cmd) File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/usr/bin/python3.6', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp6l92o96b', '--quiet', 'numpy>=1.11']' returned non-zero exit status 1. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-izquamfw/numba/setup.py", line 424, in <module> setup(**metadata) File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup _install_setup_requires(attrs) File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs replace_conflicting=True, File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 782, in resolve replace_conflicting=replace_conflicting File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1065, in best_match return self.obtain(req, installer) File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1077, in obtain return installer(requirement) File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 777, in fetch_build_egg return fetch_build_egg(self, req) File "/usr/local/lib/python3.6/site-packages/setuptools/installer.py", line 130, in fetch_build_egg raise DistutilsError(str(e)) distutils.errors.DistutilsError: Command '['/usr/bin/python3.6', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp6l92o96b', '--quiet', 'numpy>=1.11']' returned non-zero exit status 1. ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-izquamfw/numba/
截图:
说明:刘宏缔的架构森林是一个专注架构的博客,
网站:https://blog.imgtouch.com
本文: https://blog.imgtouch.com/index.php/2023/06/03/python3-yong-pip-an-zhuang-di-san-fang-ku-shi-bao-cuo/
对应的源码可以访问这里获取: https://github.com/liuhongdi/
或: https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,报错的解决:
1,更新 setuptools
[root@blog ~]# pip3 install --upgrade setuptools
再次执行:
[lhdop@blog ~]$ pip3 install backgroundremover
…
uccessfully installed Pillow-8.1.1 PySocks-1.7.1 PyWavelets-1.1.1 backgroundremover-0.1.9 beautifulsoup4-4.11.1
certifi-2022.9.24 charset-normalizer-2.0.12 commandlines-0.4.1 cycler-0.11.0 dataclasses-0.8 decorator-4.4.2
ffmpeg-python-0.2.0 filelock-3.4.1 filetype-1.1.0 future-0.18.2 gdown-4.5.1 hsh-1.1.0 idna-3.4 imageio-2.9.0
imageio-ffmpeg-0.4.7 importlib-resources-5.4.0 kiwisolver-1.3.1 llvmlite-0.36.0 matplotlib-3.3.4 more-itertools-8.7.0
moviepy-1.0.3 networkx-2.5.1 numba-0.53.1 numpy-1.19.5 proglog-0.1.10 pymatting-1.1.8 requests-2.27.1
scikit-image-0.17.2 scipy-1.5.4 six-1.16.0 soupsieve-2.3.2.post1 tifffile-2020.9.3 torch-1.10.1 torchvision-0.11.2
tqdm-4.64.1 typing-extensions-4.1.1 urllib3-1.26.6 waitress-2.0.0 zipp-3.6.0
错误未再次出现
三,查看python和pip的版本:
查看python的版本:
[lhdop@blog ~]$ python3 --version Python 3.6.8
查看pip的版本:
[lhdop@blog ~]$ python3 -m pip show pip Name: pip Version: 21.3.1 Summary: The PyPA recommended tool for installing Python packages. Home-page: https://pip.pypa.io/ Author: The pip developers Author-email: distutils-sig@python.org License: MIT Location: /usr/local/lib/python3.6/site-packages Requires: Required-by: