简体   繁体   中英

Can't import PyQt5.QtWebEngineWidgets


I'm trying to make an vocabtrainer for myself to get better in english, cause I suck. To achieve this, I'm trying to make a GUI with PyQt5 to expand my programming experience too :). But somehow I can't import the QtWebEngineWidget ...

This is my code:

import PyQt5.QtWidgets as pyqtW
import PyQt5.QtGui as pyqtG
import PyQt5.QtCore as pyqtC
from PyQt5.QtWebEngineWidgets import *

import sys


class VocabTrainer:

    def __init__(self):
        self.main = pyqtW.QApplication([])
        self.window = pyqtW.QWidget()

        self.prepareWindow()

        sys.exit(self.main.exec_())

    def prepareWindow(self):
        """
        Set's the attributes of the window.
        """

        # window settings
        self.window.resize(250, 100)
        self.window.show()

    def openPons(self):
        """
        Opens the website of pons to be able to translate words.
        """
        pass

test = VocabTrainer()

My IDE (PyCharm) warns me that it can't find the reference of PyQt5.QtWebEngineWidgets and if I run this code, I'll get this error message:

Traceback (most recent call last):
  File "/A/little/path/VocabTrainer.py", line 12, in <module>
    from PyQt5.QtWebEngineWidgets import *
ImportError: libQt5Quick.so.5: cannot open shared object file: No such file or directory

Process finished with exit code 1

I've installed the modules with the following commands:

pip install pyqt5
pip install pyqtwebengine

I've also tried to reinstall the modules but without success.

Python-Version: 3.8.1
OS: Arch Linux

In the case of ArchLinux, having the most up-to-date packages, I generally recommend using the repository packages (IMHO Arch Linux is a good laboratory to test the new functionalities :-)). Considering the above, I recommend installing pyq5 and pyqtwebengine by running the following:

sudo pacman -S python-pyqt5 python-pyqtwebengine

You must also change the python that pycharm uses to the system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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