1
votes

In Ubuntu I installed PyQt via pip

pip3 install PyQt5

However, my script still says:

Traceback (most recent call last):

File "/media/storage/Python/my_app.py", line 11, in from mainwindow import * File "/media/storage/Python/mainwindow.py", line 4, in from PyQt5 import QtCore, QtWidgets

ImportError: No module named PyQt5

Then I tried from terminal:

sudo apt-get install python3-pyqt5

and got that it is installed:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pyqt5 is already the newest version (5.7+dfsg-5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

How to convince PyCharm 2017.1 to use PyQt5? I just realized it works if I run it from terminal:

python3 my_script.py
1

1 Answers

2
votes

The problem here is that you need to set the correct interpreter in PyCharm.
To do this you can go in

Settings -> Project -> Project Interpreter

and here choose the correct one in the select at the top of the window.

After this you should see the PyQt in the list below. Then click on Apply and try to run again your script.