当前位置:   article > 正文

安装PyQt5后无法启动spyder_from qtpy import qtwebenginewidgets # analysis:ign

from qtpy import qtwebenginewidgets # analysis:ignore

解决方案在分割线下面。前面是情况说明,如果一样就可以用下面的解决方案。

在打开spyder时anaconda给我来了个报错信息。。。

  1. File "C:\MyWin\DevelopmentEnvironment\Anaconda3\Scripts\spyder-script.py", line 10, in
  2. sys.exit(main())
  3. File "C:\MyWin\DevelopmentEnvironment\Anaconda3\lib\site-packages\spyder\app\start.py", line 186, in main
  4. from spyder.app import mainwindow
  5. File "C:\MyWin\DevelopmentEnvironment\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 90, in
  6. from qtpy import QtWebEngineWidgets # analysis:ignore
  7. File "C:\MyWin\DevelopmentEnvironment\Anaconda3\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 22, in
  8. from PyQt5.QtWebEngineWidgets import QWebEnginePage
  9. ValueError: PyCapsule_GetPointer called with incorrect name

仔细看了一下后发现是PyQt5的问题,因为spyder和python内置的IDLE这些应用都是用PyQt来写的,所以对PyQt的版本其实是有要求的。

一般我们安装PyQt5和PyQt5-tools时会选择pip安装。但是pip安装会自动选择最新版本,并且会自动卸载掉之前的版本。这就会让一些用旧版本的应用打不开。但是这其实在安装的过程中pip会给我们提示的。像下面这个:

ERROR: pyqt5-tools 5.13.0.1.5 has requirement pyqt5==5.13.0, but you'll have pyqt5 5.12 which is incompatible.

但是大多数人都会在pip安装的过程中无视它。



好了现在来看看怎么办吧。

在cmd中输入:

pip check

这样就可以查看到用到PyQt的应用和包所需要的PyQt5版本了。

比如:

  1. spyder 3.3.6 requires pyqtwebengine, which is not installed.
  2. astroid 2.2.5 requires typed-ast, which is not installed.
  3. xlwings 0.15.8 has requirement pywin32>=224, but you have pywin32 223.
  4. spyder 3.3.6 has requirement pyqt5<5.13; python_version >= "3", but you have pyqt5 5.13.1.
  5. pyqt5-tools 5.13.0.1.5 has requirement pyqt5==5.13.0, but you have pyqt5 5.13.1.

之后在pip中按需安装就行了。如:

pip install pyqt5==5.12.0

 

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

闽ICP备14008679号