【问题标题】:No longer able to launch Spyder since updating PyQt5 via pip自从通过 pip 更新 PyQt5 后不再能够启动 Spyder
【发布时间】:2019-07-23 10:21:38
【问题描述】:

自从在 Ubuntu 18.04.2 LTS 上通过 python3-pip 更新我的 python3 软件包后,我无法启动 spyder,因为似乎 PyQt5 软件包的 QtWebKitWidgets 模块已被弃用。在终端中输入spyder3 时会产生以下控制台输出:

Traceback (most recent call last):
  File "/home/benjamin/.local/lib/python3.6/site-packages/qtpy/QtWebEngineWidgets.py", line 22, in <module>
    from PyQt5.QtWebEngineWidgets import QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/benjamin/.local/bin/spyder3", line 11, in <module>
    sys.exit(main())
  File "/home/benjamin/.local/lib/python3.6/site-packages/spyder/app/start.py", line 178, in main
    from spyder.app import mainwindow
  File "/home/benjamin/.local/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 90, in <module>
    from qtpy import QtWebEngineWidgets  # analysis:ignore
  File "/home/benjamin/.local/lib/python3.6/site-packages/qtpy/QtWebEngineWidgets.py", line 26, in <module>
    from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

有没有其他人偶然发现这个问题,任何人都可以提出解决方案吗? 我目前通过以下 shell 脚本更新我的 python3 包:

#!/bin/sh

#================================#
#                                #
#### UPDATE PYTHON3 LIBRARIES ####
#                                #
#================================#

### Package List ###
# bs4 - web scraping
# keras - machine learning front end
# lifelines - survival analysis
# matplotlib - plots
# numpy - array-processing package
# pandas - data management
# scipy - open-source software for mathematics, science, and engineering
# seaborn - plots
# selenium - web scraping
# spyder - IDE
# statsmodels - basic statistical methods
# tensorflow - machine learning back end

PACKAGES='bs4 keras lifelines matplotlib numpy pandas scipy seaborn selenium spyder statsmodels tensorflow'

### Update via PIP3 ###
echo 'Updating packages ...'
pip3 install $PACKAGES --user --upgrade --upgrade-strategy="eager"
echo 'Update complete ...'

...并使用位于~/.local/share/applications 的以下 Gnome 应用程序启动器链接启动 spyder

[Desktop Entry]
Type=Application
Version=1.0
Name=Spyder3
GenericName=Spyder3
Comment=The Scientific Python Development Environment - Python 3
Icon=spyder3
TryExec=spyder3
Exec=spyder3 %F
Terminal=false
MimeType=text/x-python;
Categories=Development;Science;IDE;Qt;
Keywords=Development;Science;IDE;Qt;
StartupNotify=true
StartupWMClass=Spyder

【问题讨论】:

    标签: python-3.x pip pyqt5 spyder


    【解决方案1】:

    这里是 Spyder 维护者)要解决这个问题,你还需要安装pyqtwebengine(除了pyqt5),像这样

    pip install pyqtwebengine
    

    注意:我们意识到 WebEngine 与 PyQt5 是在我们发布最后一个版本 (3.3.3) 后才分离出来的。但这将在我们将于 2019 年 3 月发布的下一个版本 (3.3.4) 中得到解决。

    【讨论】:

    • 感谢您的帮助。这解决了问题。我现在唯一的烦恼是所有图标都不见了,但我可以在下一个版本发布之前解决这个问题。
    猜你喜欢
    • 2020-12-04
    • 2019-10-01
    • 2018-04-24
    • 2017-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-01
    相关资源
    最近更新 更多