A
A
amogusnikov2022-04-18 14:52:12
PyQt
amogusnikov, 2022-04-18 14:52:12

Why does the terminal throw an error ModuleNotFoundError: No module named 'PyQt5.QtWidgets'; 'PyQt5' is not a package?

spoiler
The code itself:
import sys
from PyQt5.QtWidgets import QApplication, QWidget


if __name__ == '__main__':

    app = QApplication(sys.argv)

    w = QWidget()
    w.resize(800, 600)
    w.move(300, 300)
    w.setWindowTitle('Приложение')
    w.show()

    sys.exit(app.exec_())

spoiler
Mistake:
from PyQt5.QtWidgets import QApplication, QWidget
ModuleNotFoundError: No module named 'PyQt5.QtWidgets'; 'PyQt5' is not a package

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
ANYJT, 2022-04-18
@ANYJT

The terminal screams that there are no such modules called 'PyQt5.QtWidgets'; 'PyQt5.
Maybe you mistyped the title?

S
seven5674, 2022-04-18
@seven5674

Working example
Perhaps the launch is in the wrong environment

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question