通过pip更新PyQt5后,无法再启动Spyder

时间:2019-03-01 11:26:58

标签: python-3.x pip pyqt5 spyder

自从在Ubuntu 18.04.2 LTS上通过python3-pip更新我的python3软件包以来,我无法启动spyder,因为QtWebKitWidgets软件包的PyQt5模块具有不推荐使用。在终端中输入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 ...'

...并使用位于spyder中的以下Gnome应用程序启动器链接启动~/.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

1 个答案:

答案 0 :(得分:1)

(此处为 Spyder维护程序)要解决此问题,您还需要安装pyqtwebengine(除了pyqt5之外)

pip install pyqtwebengine

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