[英]`pip install` Gives Error on Some Packages
当我尝试使用pip install
安装它们时,某些包会出错。 这是我尝试安装chatterbot
时的错误,但其他一些软件包也会出现此错误:
pip install chatterbot
Collecting chatterbot
Using cached ChatterBot-1.0.5-py2.py3-none-any.whl (67 kB)
Collecting pint>=0.8.1
Downloading Pint-0.19.2.tar.gz (292 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 292.0/292.0 kB 1.6 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting pyyaml<5.2,>=5.1
Using cached PyYAML-5.1.2.tar.gz (265 kB)
Preparing metadata (setup.py) ... done
Collecting spacy<2.2,>=2.1
Using cached spacy-2.1.9.tar.gz (30.7 MB)
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [35 lines of output]
Collecting setuptools
Using cached setuptools-65.0.1-py3-none-any.whl (1.2 MB)
Collecting wheel<0.33.0,>0.32.0
Using cached wheel-0.32.3-py2.py3-none-any.whl (21 kB)
Collecting Cython
Using cached Cython-0.29.32-py2.py3-none-any.whl (986 kB)
Collecting cymem<2.1.0,>=2.0.2
Using cached cymem-2.0.6-cp310-cp310-win_amd64.whl (36 kB)
Collecting preshed<2.1.0,>=2.0.1
Using cached preshed-2.0.1.tar.gz (113 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1
[6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\oguls\AppData\Local\Temp\pip-install-qce7tdof\preshed_546a51fe26c74852ab50db073ad57f1f\setup.py", line 9, in <module>
from distutils import ccompiler, msvccompiler
ImportError: cannot import name 'msvccompiler' from 'distutils' (C:\Users\oguls\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\__init__.py)
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Encountered error while generating package metadata.
See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
我不知道具体是哪些包导致了这个错误,很多安装都没有问题。
我已经尝试更新 pip、更改环境变量和我在 inte.net 上找到的其他可能的解决方案,但似乎没有任何效果。
编辑:我尝试安装的 package 支持我的 Python 版本。
在您的情况下,真正的错误是:
ImportError: cannot import name 'msvccompiler' from 'distutils'
发生这种情况是因为setuptools
在 65.0.0 版本中破坏了distutils
(并且已经在 65.0.2 版本中修复了它) 。 根据您的日志,您的全局setuptools
安装中出现了错误(请参阅错误消息中的路径),因此您需要使用以下命令对其进行更新:
pip install -U setuptools
但是,这些软件包可能仍未安装或无法正常工作,因为导致此错误的模块不支持当前支持的 Python 版本所需的编译器版本。
同样的事情发生在我身上,这基本上是 pip 的版本问题。 尝试将 pip 升级到最新版本 --22.3.1 并将 python 版本从最新版本 --3.10.00 降级到 3.9.13 ...
pip --version
检查 pip 的版本
pip install notebook --upgrade
--upgrade -命令更新pip到最新版本
这对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.