我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'
答案1
值得了解这里发生的事情,因为解决方案看起来违反直觉:
openshot-qt
是用 Python 编写的,需要PyQt5.QtWebKitWidgets
Ubuntu 包提供的模块python3-pyqt5.qtwebkit
。apt
通过get安装的所有 Python 模块都安装到 中/usr/lib/python3/dist-packages
。- 所有由 Python 包管理工具(例如
pip
)安装的 Python 模块都会安装到 中/usr/local/lib/python3.6/dist-packages
。此规则也有例外,例如使用虚拟环境但这不适用于这里。 /usr/local/lib/python3.6/dist-packages
如果和中都存在某个包/usr/lib/python3/dist-packages
,则 中的版本/usr/local/lib/python3.6/dist-packages
优先(这是 安装的版本pip
)。- 这一条很重要:
PyQt5
删除QtWebKitWidgets
了v5.6在他们的发行版中。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 所针对的。