I do everything as described in this guide , but nothing happens.

Here is the code

import sys from PyQt5.QtWidgets import QWidgets, QDesktopWidget, QApplication 

Here is a mistake

Traceback (most recent call last): File "test.py", line 2, from PyQt5.QtWidgets import QWidgets, QDesktopWidget, QApplication ModuleNotFoundError: No module named 'PyQt5.QtWidgets'

I use Python 3.6 32-bit

Out of interest, I decided to look at the python, but he swears and does not want to show anything.

  • The question should make sense even if the link dies in your question. Therefore, obviously the steps, as you tried to install pyqt5, give. - jfs
  • I downloaded PyQt5 from the office. site, renamed the folder to "PyQt5" and threw it into the Lib. Tried it through Pip, installed it in PyCharm. I tried different versions of python. 3.4, 3.5, 3.6. Nothing helped - DeBill
  • all the information needed to answer should be in the question itself. Do not put the information necessary for the answer in the comments to your own question, edit the question itself instead (see the edit button under the question). "Nothing helped" - not informative (instead, it is better to write: I did this, I expected this, but I received this one in steps). - jfs
  • Edit the question yourself. I have no desire to do this. All the same, the question has no answers and will not. The problem is googled in 5 seconds, there is no answer anywhere. - DeBill

3 answers 3

Really. Put PyCharm and python 3.6.2 as the project interpreter, plus installed the PyQt5 library via pip3. Did as in the guide it says the same mistake. If you run a file with a code outside of PyCharm from the terminal, then everything works, since the operating system uses python 3.5.2. If run from PyCharm, it does not work. I have Ubuntu 16.04, which means that it is not important to reproduce an OS error.

I changed the interpreter to the python 3.5.2 version in the project settings and it all worked. I looked closely and saw that in the main system used, the version of python 3.5.2 has the PyQt5 library, and when changing the project interpreter to python 3.6.2 it is not.

It is treated like this: File - Settings - Project: {name_my_project} - Project Interpreter - install the version of the interpreter we need (python 3.6.2 for example) - Install (plus on the side) - Available Packages - type in PyQt5 search - click Install Package

  • sudo apt-get install python3-pyqt5 command by reference puts PyQt5 on the system python (Python 3.5 on your Ubuntu). pip3 not clear to which python is yours. It is expected that if you configured PyCharm to use Python 3.6, you will not see PyQt5 in PyCharm - if you want to use Python 3.6, put libraries for it, if you want to use Python 3.5, then you should install separate libraries. Did you expect to install PyQt5 on Python 3.6 automatically for Python 3.5? - jfs
  • In this case, the same distribution ( PyQt5-5.9-5.9.1-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl on Linux) can be used to install on different versions using the same pip install PyQt5 inside the corresponding virtualenv. For each Python, run the installer separately. - jfs
  • Your comments are correct, but I just reproduced the problem and found a way out of it. Using virtualenv is much better and more convenient. Totally agree with you. - Dving September

Because the library is called PyQt5.QtWidgets

  • Anyway from PyQt5.QtWidgets import QWidgets, QDesktopWidget, QApplication ModuleNotFoundError: No module named 'PyQt5.QtWidgets'. I simply changed the text out of interest. Need to fix the question. - DeBill
  • Mmm. python3-pyqt5 and pyqt5-dev-tools cost? - Nikita Putyozub
  • I downloaded PyQt5_gpl-5.9.zip from this page , renamed the folder to PyQt5 and copied it to the Python lib folder - DeBill
  • @TryCatch, and you know that you downloaded source files, not binaries? The next paragraph is what you need - Nikita Putyrozub
  • If you are talking about this , now I downloaded PyQt5-5.9-5.9.1-cp35.cp36.cp37-none-win32.whl , but I don’t know such a format and I don’t even know where to put it - DeBill

Use Pycharm and from there download libraries \ modules. If you are sure that you did everything correctly, then try using the from <name of the library \ module> import *.

  • Just PyQt5 connects without problems. But that which should not connect - DeBill