简体   繁体   中英

PyCharm error - No module named 'sip' (PyQt4)

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: 这是我认为我在 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!

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.

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

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