简体   繁体   中英

PyQt5 Error in PyCharm IDE

I have PyQt5 Installed and I created a GUI and edited it using Sublime Text, Now I want to use PyCharm and I saw posts that you don't have to configure PyQt5, it is automatically detected by PyCharm.

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QPixmap
from mainpy import kitcode

PyQt5 , QtCore , QtGui , QtWidgets , PyQt5.QtWidgets , PyQt5.QtGui , QPixmap , mainpy and kitcode are all in red underline.

And when I run it, I get the error

Traceback (most recent call last):
  File "C:/Users/username/Desktop/folder/PythonThesis/mainpy.py", line 9, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
ImportError: No module named 'PyQt5'

Process finished with exit code 1

any help would be appreciated and sorry if this is basic, I am still new to python. Thank you very much.

did you fix this problem?

You may need to tell PyCharm which Python do you want to use for your current project. You can do this by configuring Python interpreter from Settings/Preferences/Project Interpreter. Be careful to find the proper Python with PyQt5. You can find more information on the official website . An extra tip is you can edit run configuration, including Python interpreter for the next run, before running projects by using the shortcut Shift + Alt + F10 .

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