本文介绍了由于 PyQt5.QtWebKitWidgets 无法启动 spyder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 spyder 时遇到问题.

I have a problem with spyder.

我刚刚在这台笔记本电脑上安装了 Python 3.7 和 Spyder,就像我在许多其他笔记本电脑上所做的那样.然而这一次,它不起作用.

I just installed on this laptop Python 3.7 and Spyder, as I did on many others. However this time, it doesn't work.

我在 win32 上安装了 Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 位 (AMD64)] 与安装程序.我将路径更改为自定义路径:C:\Python\Python37,我添加了预编译库并添加了环境的路径.笔记本电脑在那时重新启动.

I installed Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32 with the installer. I changed the path to a custom path: C:\Python\Python37, I added the precompile library and I added the path to the environment.The laptop was rebooted at that point.

然后我更新了pip:

py -3.7 -m pip install --upgrade pip

然后我安装了spyder:

And then I installed spyder:

py -3.7 -m pip install spyder

然后我尝试使用该文件启动 spyder:

I then try to launch spyder with the file:

C:\Python\Pythno37\Lib\site-packages\spyder\app\start.py

我收到错误:

ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

PyQt5 已安装 5.12 版.

PyQt5 is installed with version 5.12.

不知道为什么它不起作用...

No clue why it doesn't work...

完整的错误信息:

表明问题来自qtpy.但是,相应的文件导入:

It sugggest that the problem comes from qtpy. However, the corresponding file imports:

from . import PYQT5,PYSIDE2, PYQT4, PYSIDE, PythonQtError


# To test if we are using WebEngine or WebKit
WEBENGINE = True


if PYQT5:
    try:
        from PyQt5.QtWebEngineWidgets import QWebEnginePage
        from PyQt5.QtWebEngineWidgets import QWebEngineView
        from PyQt5.QtWebEngineWidgets import QWebEngineSettings
    except ImportError:
        from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
        from PyQt5.QtWebKitWidgets import QWebView as QWebEngineView
        from PyQt5.QtWebKit import QWebSettings as QWebEngineSettings
        WEBENGINE = False

PyQt5.QtWebEngnieWidgets 使用正确.

推荐答案

我将 Pyqt5 版本从 5.12 换成了 5.11.2:

I swapped Pyqt5 version from 5.12 to 5.11.2 with:

py -m pip install pyqt5==5.11.2

现在它可以工作了...

And now it works...

这篇关于由于 PyQt5.QtWebKitWidgets 无法启动 spyder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 15:49