9

I have installed Python 3.7.1 and trying to run a form created using QTdesigner.But this error occurred.I have also installed PyQt5 module using

pip install PyQt5

The error is:

from PyQt5 import QtCore, QtGui, QtWidgets   

ModuleNotFoundError: No module named 'PyQt5'

8 Answers 8

15

Python and pip seem to be running on different versions.

If you're using various versions of Python, use python -m pip install PyQt5 instead of pip.

Sign up to request clarification or add additional context in comments.

2 Comments

pyqt5 version:5.11.3 is installed for python 3.7.1.Is it proper..?
I'm clueless that PyQt5 is available on Python 3.7. Testing in Python 3.6 is also a good way.
4

I have used all the below mentioned commands having done it with both VS terminal and cmd:

python -m pip install pyqt5
pip3 install pyqt5
python -m pip.py install pyqt5

Although it did install correctly but when I import PyQt5.QWidgets i get an error stating module not found. I am saying it did install correctly because when I run these commands again get a message "Requirements already satisfied".

Comments

2

You can use pip3 to install a python3 module:

pip3 install PyQt5

Comments

2

It seems like your pycharm is configured to use virtual environment. Try installing PyQt5 from pycharm terminal. It will install PyQt5 in your virtual environment and it fixed the issue in my case.

Comments

2

Try this : Check your python directory correctly installed or Not. Go to the below a directory by cmd and run the commands.

C:\Users\PC_NAME\AppData\Local\Programs\Python\Python37-32\Scripts>

pip install PyQt5

your PRO.py program now ready to run successfully.

1 Comment

This worked! Thanks! Note: \Python37-32\ is referring to your Python version, in case you made the same mistake as me lol. You can also do 'dir' and see the Python(#) folder
0

I had a similar error when starting with PyQT5. Do not know if this might answer your question but here was my scenario. I had both python 2.7 and python 3.7 on my machine. My pip 2.7 was added to the path instead of the 3.7. So i removed python 2.7 from the path, reinstalled python 3.7 and added to the path and restarted. After that used pip to install pyqt5 and it worked like a charm

Comments

0

i solved it by using python -m pip install PyQt5 on windows not pip install PyQt5

1 Comment

I'm gonna guess that if you run where.exe python and where.exe pip you get different paths?
0

For me the problem was solved by uninstalling the pip version and instead installing from apt:

pip3 uninstall PyQt5
sudo apt-get install python3-pyqt5

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.