我Openshot
在 Ubuntu 18.04 LTS 中安装了
sudo apt-get install openshot-qt
当我尝试openshot-qt
在终端中打开它时,它会失败并出现错误:
Traceback (most recent call last):
File "/usr/bin/openshot-qt", line 11, in <module>
load_entry_point('openshot-qt==2.5.1.dev2', 'gui_scripts', 'openshot-qt')()
File "/usr/lib/python3/dist-packages/openshot_qt/launch.py", line 97, in main
app = OpenShotApp(argv)
File "/usr/lib/python3/dist-packages/openshot_qt/classes/app.py", line 220, in __init__
from windows.main_window import MainWindow
File "/usr/lib/python3/dist-packages/openshot_qt/windows/main_window.py", line 45, in <module>
from windows.views.timeline_webview import TimelineWebView
File "/usr/lib/python3/dist-packages/openshot_qt/windows/views/timeline_webview.py", line 42, in <module>
from PyQt5.QtWebKitWidgets import QWebView
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'
sudo apt-get install python3-pyqt5.qtwebengine
我根据这个问题试过了。但是打开 openshot 会出现同样的错误,尽管 about 命令会给出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pyqt5.qtwebengine is already the newest version (5.10.1+dfsg-1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 50 not upgraded.
有人可以提供解决方案吗?
编辑:
输出apt-cache policy python3-pyqt5.qtwebkit
:
python3-pyqt5.qtwebkit:
Installed: 5.10.1+dfsg-1ubuntu2
Candidate: 5.10.1+dfsg-1ubuntu2
Version table:
*** 5.10.1+dfsg-1ubuntu2 500
500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
100 /var/lib/dpkg/status
输出ls -l /usr/lib/python3/dist-packages/PyQt5/
:
-rw-r--r-- 1 root root 826 Feb 27 2018 __init__.py
drwxr-xr-x 2 root root 4096 Sep 15 2019 __pycache__
-rw-r--r-- 1 root root 237384 Apr 23 2018 _QOpenGLFunctions_2_0.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 241624 Apr 23 2018 _QOpenGLFunctions_2_1.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 122296 Apr 23 2018 _QOpenGLFunctions_4_1_Core.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 2955992 Apr 23 2018 QtCore.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 370919 Apr 23 2018 QtCore.pyi
-rw-r--r-- 1 root root 6120 Apr 23 2018 Qt.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 212696 Apr 23 2018 QtDBus.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 22776 Apr 23 2018 QtDBus.pyi
-rw-r--r-- 1 root root 332392 Apr 23 2018 QtDesigner.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 22328 Apr 23 2018 QtDesigner.pyi
-rw-r--r-- 1 root root 3287320 Apr 23 2018 QtGui.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 382629 Apr 23 2018 QtGui.pyi
-rw-r--r-- 1 root root 157560 Apr 23 2018 QtHelp.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 9226 Apr 23 2018 QtHelp.pyi
-rw-r--r-- 1 root root 698304 Apr 23 2018 QtMultimedia.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 83508 Apr 23 2018 QtMultimedia.pyi
-rw-r--r-- 1 root root 102848 Apr 23 2018 QtMultimediaWidgets.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 4571 Apr 23 2018 QtMultimediaWidgets.pyi
-rw-r--r-- 1 root root 859448 Apr 23 2018 QtNetwork.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 94874 Apr 23 2018 QtNetwork.pyi
-rw-r--r-- 1 root root 143192 Apr 23 2018 QtOpenGL.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 15653 Apr 23 2018 QtOpenGL.pyi
-rw-r--r-- 1 root root 239720 Apr 23 2018 QtPrintSupport.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 19835 Apr 23 2018 QtPrintSupport.pyi
-rw-r--r-- 1 root root 104528 Apr 23 2018 QtSvg.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 5909 Apr 23 2018 QtSvg.pyi
-rw-r--r-- 1 root root 103104 Apr 23 2018 QtTest.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 10827 Apr 23 2018 QtTest.pyi
-rw-r--r-- 1 root root 33920 Apr 23 2018 QtWebChannel.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 2480 Apr 23 2018 QtWebChannel.pyi
-rw-r--r-- 1 root root 67992 Apr 23 2018 QtWebEngineCore.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 7141 Apr 23 2018 QtWebEngineCore.pyi
-rw-r--r-- 1 root root 54304 Apr 23 2018 QtWebEngine.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 6582 Apr 23 2018 QtWebEngine.pyi
-rw-r--r-- 1 root root 239800 Apr 23 2018 QtWebEngineWidgets.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 32973 Apr 23 2018 QtWebEngineWidgets.pyi
-rw-r--r-- 1 root root 170264 Apr 23 2018 QtWebKit.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 18340 Apr 23 2018 QtWebKit.pyi
-rw-r--r-- 1 root root 317720 Apr 23 2018 QtWebKitWidgets.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 32123 Apr 23 2018 QtWebKitWidgets.pyi
-rw-r--r-- 1 root root 5498280 Apr 23 2018 QtWidgets.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 500483 Apr 23 2018 QtWidgets.pyi
-rw-r--r-- 1 root root 315744 Apr 23 2018 QtXml.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 27507 Apr 23 2018 QtXml.pyi
drwxr-xr-x 7 root root 4096 Sep 15 2019 uic
输出python3 -c "import PyQt5.QtWebKitWidgets"
:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'
值得了解这里发生的事情,因为解决方案似乎违反直觉:
openshot-qt
是用 Python 编写的,需要PyQt5.QtWebKitWidgets
Ubuntu 软件包提供的模块python3-pyqt5.qtwebkit
。apt
通过get 安装的所有 Python 模块都安装到/usr/lib/python3/dist-packages
.pip
Python 包管理工具(例如)安装的所有 Python 模块都安装到/usr/local/lib/python3.6/dist-packages
. 这条规则有例外,比如使用virtualenv时,但这里不适用。/usr/local/lib/python3.6/dist-packages
和/usr/lib/python3/dist-packages
中,则 中的版本/usr/local/lib/python3.6/dist-packages
优先(这是由 安装的版本pip
)。PyQt5
删除了v5.6QtWebKitWidgets
中的支持。Ubuntu 似乎在他们的 v5.10 包中保留了对它的自定义支持。/usr/local/lib/python3.6/dist-packages
是> = v5.6所以你的问题是,有一个新版本的
PyQt5
安装没有你需要的模块,它基本上覆盖了你需要的模块的 Ubuntu 版本。然后解决方案是删除较新的版本,以便您的系统将使用 Ubuntu 提供的版本。你可以通过运行来做到这一点sudo pip3 uninstall pyqt5
。这样做后,确认该目录/usr/local/lib/python3.6/dist-packages/PyQt5
已消失。有可能某些非 apt 受控程序实际上需要更新版本的,
PyQt5
但这种情况正是 virtualenv 的用途。