问题:
pip install pyqt5 Collecting pyqt5 Using cached PyQt5-5.15.10-cp37-abi3-win_amd64.whl.metadata (2.2 kB) Collecting PyQt5-sip<13,>=12.13 (from pyqt5) Using cached PyQt5_sip-12.13.0.tar.gz (123 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting PyQt5-Qt5>=5.15.2 (from pyqt5) Using cached PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl.metadata (552 bytes) Using cached PyQt5-5.15.10-cp37-abi3-win_amd64.whl (6.8 MB) Using cached PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl (50.1 MB) Building wheels for collected packages: PyQt5-sip Building wheel for PyQt5-sip (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for PyQt5-sip (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [5 lines of output] 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-sip Failed to build PyQt5-sip ERROR: Could not build wheels for PyQt5-sip, which is required to install pyproject.toml-based projects
解决办法:
这个错误提示表明在构建PyQt5-sip时出现了问题,与之前提到的相同。错误信息指出需要安装Microsoft Visual C++ 14.0或更高版本。
你可以按照以下步骤解决问题:
-
确保你已安装了Microsoft Visual C++ Build Tools。你可以从以下链接中下载并安装:https://visualstudio.microsoft.com/visual-cpp-build-tools/
-
安装完Visual C++ Build Tools后,尝试重新安装PyQt5。可以使用以下命令:pip install pyqt5
特别是第一步的安装说明:
下载这个工具后,点击运行,会到如下的界面,选择第一个C++ 和右边的选项,然后点击右下角的安装,等待系统自动安装即可。
标签:building,wheel,sip,pyqt5,C++,PyQt5,报错,build From: https://www.cnblogs.com/zhangliang88/p/18139529