自从通过 pip 更新 PyQt5 后不再能够启动 Spyder [英] No longer able to launch Spyder since updating PyQt5 via pip

查看:59
本文介绍了自从通过 pip 更新 PyQt5 后不再能够启动 Spyder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Since updating my python3 packages via python3-pip on Ubuntu 18.04.2 LTS I am unable to launch spyder as it appears that the QtWebKitWidgets module of the PyQt5 package has been deprecated. The following console output is produced upon entering spyder3 in the terminal:

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 包:

Has anyone else stumbled across this problem, and could anyone suggest a solution? I currently update my python3 packages via the following shell script:

#!/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:

... and launch spyder using the following Gnome applications launcher link, located in ~/.local/share/applications:

[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

推荐答案

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

(Spyder maintainer here) To fix this problem you also need to install pyqtwebengine (besides pyqt5), like this

pip install pyqtwebengine

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

Note: We realized WebEngine was separated from PyQt5 only after we released our last version (3.3.3). But that's going to be fixed in our next one (3.3.4), to be released in March/2019.

这篇关于自从通过 pip 更新 PyQt5 后不再能够启动 Spyder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆