简体   繁体   中英

Cannot import PyQt5 modules

I installed PyQt5 as following:

pip3 install pyqt5

Nevertheless, when I run the module, the output is an error telling me that QtWidgets cannot be imported as any other Qt module. I then tried different syntaxes as:

from PyQt5.QtWidgets import QApplication, QWidget

or

from PyQt5 import PyQt5.QtWidgets

None of those options are working.

pip3 install pyqt5
import PyQt5.QtWidgets as QtWidgets

你可以这样使用它。它对我有用。

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