0

OK, so I need to make a project in PyQt, and I'm using PyQt4 since I found more tutorials on this and it is easier for me. I installed PyCharm as my IDE. I haven't had any python compilers so I installed Python 3.7.5 (from Microsoft Store since PyCharm recommended that), and configured the interpreter in PyCharm (so now, python works)

Then, I needed to install PyQt4, and since it didn't work from PyCharm's project interpreter -> install package, I downloaded "PyQt4-4.11.4-cp37-cp37m-win_amd64" and installed it with pip.
Then, I installed sip also with pip. The thing is that I get an error in my code in PyCharm.
from PyQt4 import QtGui
ModuleNotFoundError: No module named 'sip'

I also configured all my Windows PATHs, when I installed sip it gave me an error saying that the path isn't added. I added that path. I also added the pyqt4 path. These are my paths:

C:\Users\b997a\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sipbuild

C:\Users\b997a\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages

'C:\Users\b997a\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts

And these are all the packages I think I have installed in PyCharm: And this are all the packages I think I have installed in PyCharm

Do you know what I can do? I really don't want to use PyQt5 since I know a found tutorials on exactly what I want to do on PyQt4 and I don't really have time to learn PyQt5 now...

I also tried to see if Python 3.7.5 Shell (IDLE) will raise an error, and yes, it did. I have the same error in Python's IDLE.

What is the problem? It worked for a while until I deleted Python a few weeks ago, but now it doesn't work anymore.

Thanks a lot!

Community
  • 1
  • 1
Andrew T
  • 79
  • 1
  • 1
  • 9

1 Answers1

0

I have recently faced such issues, so my recommendations are:

  1. It's good to activate your virtual env for your project.
  2. Usually pip should install the required binaries, but if it doesn't, try searching the same from pycharm -> settings and add directly from there. This has always worked for me.

P.S. I was not able to add comment, so I posted it as answer.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
mamtach
  • 88
  • 3
  • 13
  • Thanks for the answer but:
    1) I don't know what you are saying about activating my virtual env for my project.
    2) I also installed the packages from PyCharm. This is why i posted that picture. These are the packages I have installed.
    – Andrew T Dec 21 '19 at 20:16
  • @AndrewT Next to "project interpreter" on your pycharm screen shot; there is an add button, pls select virtual environment from there, select the python interpreter. So all the referred binaries, modules will be installed in your virtual env. OR you can create a virtualenv directly from shell [virtualenv](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments) – mamtach Dec 22 '19 at 08:23
  • also - [virtualenv on pycharm](https://www.jetbrains.com/help/pycharm-edu/creating-virtual-environment.html) – mamtach Dec 22 '19 at 08:34