简体   繁体   English

无法在Python3中导入QtWebEngineWidgets

[英]Can't import QtWebEngineWidgets in Python3

I'm currently developing a web browser in Python using Qt5. 我目前正在使用Qt5在Python中开发Web浏览器。 However, when I try to run it, I get the following: 但是,当我尝试运行它时,得到以下信息:

ImportError: No module named QtWebEngineWidgets

What this error is referring to is one of the import statements in my code: 该错误指的是我的代码中的import语句之一:

from PyQt5.QtWebEngineWidgets import QWebView

If anyone could help me here, it'd be much appreciated. 如果有人可以在这里帮助我,将不胜感激。

-CodeExecution -CodeExecution

Seems like the package "python-pyqt5.qtwebengine" doesn't exist in the Raspbian (the OS I'm running on my RPi) repositories, but it does exist in the Debian Sid repositories. 似乎软件包“ python-pyqt5.qtwebengine”在Raspbian(我在RPi上运行的操作系统)存储库中不存在,但在Debian Sid存储库中确实存在。 I had to add the Debian Sid mirror to my /etc/apt/sources.list, and then run the following commands to make my system "trust" the Debian repositories: 我必须将Debian Sid镜像添加到我的/etc/apt/sources.list中,然后运行以下命令以使我的系统“信任” Debian存储库:

gpg -a --export 04EE7237B7D453EC | sudo apt-key add -
gpg -a --export 7638D0442B90D010 | sudo apt-key add -

Then I did sudo apt update, and then sudo apt install python-pyqt5.qtwebengine. 然后我做了sudo apt更新,然后sudo apt安装了python-pyqt5.qtwebengine。 It's installing right now. 现在正在安装。 After it has finished installing, I will remove the Debian Sid repositories. 安装完成后,我将删除Debian Sid存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM