当前位置:   article > 正文

安装pyqt5遇到的问题(已解决)_error: could not build wheels for pyqt5-sip, which

error: could not build wheels for pyqt5-sip, which is required to install py

打算安装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,这篇文章的哥们也是这个问题,下面有个回复解释了一下,然后给出了解决办法:安装指定版本

python -m pip install PyQt5==5.15.2

于是成功安装pyqt5! 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/117501
推荐阅读
相关标签
  

闽ICP备14008679号