打算安装pyqt5,然后pip install PyQt5
报错:
Command "g:\python3.7\python.exe g:\python3.7\lib\site-packages\pip install --ignore-installed --no-user --prefix C:\Users\用户\AppData\Local\Temp\pip-build-env-o2fimxzi\overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- "sip >=6.4, <7" "PyQt-builder >=1.9, <2"" failed with error code 2 in None
可以下载,但是安装不行。
然后发现是没安装sip,于是pip install sip
还是报错:
Command "g:\python3.7\python.exe g:\python3.7\lib\site-packages\pip\_vendor\pep517\_in_process.py prepare_metadata_for_build_wheel C:\Users\用户\AppData\Local\Temp\tmp8voqpa7g" failed with error code 1 in C:\Users\用户\AppData\Local\Temp\pip-install-_xhpmsom\sip
于是接着搜索,发现是没有wheel模块,接着pip install wheel
wheel安装成功!
继续pip install sip
报错:
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
Failed building wheel for sip
Running setup.py clean for sip
Failed to build sip
Could not build wheels for sip which use PEP 517 and cannot be installed directly
搜索发现是缺少Visual C++ 14.0。
按照Microsoft Visual C++ 14.0 is required解决方法 - 知乎 (zhihu.com)
的办法成功安装VC++
继续pip install sip
sip安装成功!
接着pip install PyQt5还是失败
报错中有:
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
然后Google,找到python - AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel' for PyQt5 5.15.0 - Stack Overflow
此时我默认安装的版本是PyQt5 5.15.6,这篇文章的哥们也是这个问题,下面有个回复解释了一下,然后给出了解决办法:安装指定版本文章来源:https://www.toymoban.com/news/detail-443440.html
python -m pip install PyQt5==5.15.2
于是成功安装pyqt5! 文章来源地址https://www.toymoban.com/news/detail-443440.html
到了这里,关于安装pyqt5遇到的问题(已解决)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!