我无法安装 pyqt5 [关闭]

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

当我尝试在 pycharm 终端和 cmd 和 vscode 中安装时,我遇到了同样的错误。 它说无法为 PyQt5-sip 构建轮子,这是安装基于 pyproject.toml 的项目所必需的

以下是该错误的文本:

ERROR: Could not build wheels for PyQt5-sip, which is required to install pyproject.toml-based projects

我安装了那个文本中的包,但是还有同样的错误。

这里是所有的错误文本:

error: subprocess-exited-with-error
  
  × Building wheel for PyQt5-sip (pyproject.toml) did not run successfully.
  │ exit code: 1
      running bdist_wheel
      running build
      running build_ext
      building 'PyQt5.sip' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ 
Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.    
  ERROR: Failed building wheel for PyQt5-sipFailed to build PyQt5-sip
ERROR: Could not build wheels for PyQt5-sip, which is required to install pyproject.toml-based projects
python pip pycharm pyqt5
1个回答
0
投票

通常,当你拉取不正确或损坏的存储库时,你会得到这个。
PS:有时,您可能没有正确的 VC++。不过,大多数时候情况可能并非如此。

虽然,我可能很难理解你的问题,但是,这应该适用于 Python 3.

## update pip
python3 -m pip install --upgrade pip 
## install with pip
pip install PyQt5-sip

## or
python3 -m pip install pyqt5-sip

注意:PyQt5-sip 12.12.0 于 2023 年 4 月 10 日发布
所以:这可能有帮助

[更新1] 如果您使用

conda
而不是
pip
,请尝试
conda install pyqt5-sip
conda install -c conda-forge pyqt5-sip

注意:截至 2023 年 4 月 13 日,
conda
将安装
PyQt5-sip-12.11.0

[更新2] 使用

pip
,我无法重现您的错误。

(base) C:\Users\XXXXX>pip install pyqt5-sip
Collecting pyqt5-sip
  Downloading PyQt5_sip-12.12.0-cp38-cp38-win_amd64.whl (78 kB)
     ---------------------------------------- 78.1/78.1 kB 2.2 MB/s eta 0:00:00
Installing collected packages: pyqt5-sip
Successfully installed pyqt5-sip-12.12.0

(base) C:\Users\XXXXX>pip uninstall pyqt5-sip
© www.soinside.com 2019 - 2024. All rights reserved.