`pip install` 在某些包上出错

问题描述 投票:0回答:4

当我尝试使用

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,改变环境变量和其他我在网上找到的可能的解决方案,但似乎没有任何效果。

编辑: 我要安装的包支持我的 Python 版本。

python pip dependencies setuptools setup.py
4个回答
4
投票

你的情况的真正错误是:

ImportError: cannot import name 'msvccompiler' from 'distutils'

发生是因为

setuptools
在版本 65.0.0 中破坏了
distutils
(并且已经在版本 65.0.2 中修复了它)
。根据你的日志,错误发生在你的全局
setuptools
安装中(查看错误信息中的路径),所以你需要使用以下命令更新它:

pip install -U setuptools

然而,这些包可能仍未安装或无法正常工作,因为 导致此错误的模块不支持当前支持的 Python 版本所需的编译器版本


0
投票

我也遇到过,基本是pip的版本问题。 尝试将 pip 升级到最新版本 --22.3.1 并将 python 版本从最新版本 --3.10.00 降级到 3.9.13 ...

pip --version
检查 pip 的版本

pip install notebook --upgrade
- 将 pip 更新到最新版本的命令

这对我有用


0
投票

根据我的经验,这是 Python3.10 的问题。我对这些错误感到疯狂,然后尝试升级和降级。与 Python 3.11 或 3.8 完美配合。 (无法添加评论,因此...)


0
投票

我在 windows 11 上成功安装了 kivy 并且我发现了错误 tras ejecutar

python -m pip install "kivy[base]" kivy_examples --no-binary kivy
。 El error es el siguiente:

Collecting kivy[base]

使用缓存的 Kivy-2.1.0.tar.gz (23.8 MB) 安装构建依赖项...错误 错误:子进程因错误而退出

× 用于安装构建依赖项的 pip 子进程未成功运行。 │ 退出代码:1 ╰─> [10行输出] 收集设置工具 使用缓存的 setuptools-67.7.1-py3-none-any.whl (1.1 MB) 收集轮 使用缓存的 wheel-0.40.0-py3-none-any.whl (64 kB) 收集cython!=0.27,!=0.27.2,<=0.29.28,>=0.24 使用缓存的 Cython-0.29.28-py2.py3-none-any.whl (983 kB) 收集 kivy_deps.gstreamer_dev~=0.3.3 使用缓存的 kivy_deps.gstreamer_dev-0.3.3-cp311-cp311-win_amd64.whl (3.9 MB) 错误:找不到满足要求的版本 kivy_deps.sdl2_dev~=0.4.5(来自版本:0.5.1、0.6.0) 错误:找不到 kivy_deps.sdl2_dev~=0.4.5 的匹配分布 [输出结束]

注意:此错误源自子进程,可能不是 pip 的问题。 错误:子进程因错误而退出

× 用于安装构建依赖项的 pip 子进程未成功运行。 │ 退出代码:1 ╰─> 见上文输出。

注意:此错误源自子进程,可能不是 pip 的问题。

© www.soinside.com 2019 - 2024. All rights reserved.