Reputation: 91
I have build a program with PyQt5 as the GUI. The program was working perfectly just moments ago. But, when I ran the program recently I got this error:
ImportError: cannot import name 'QtCore' from 'PyQt5' (/Users/Febin.J/Documents/Projects/Python Projects/Planner Builder/venv/lib/python3.8/site-packages/PyQt5/__init__.py)
The strange thing is I did not change any code. Just all of a sudden I keep getting this error.
I ran the program from VS Code and the Mac Terminal but still get the same error.
This is where the error is occuring:
from PyQt5 import QtCore, QtGui, QtWidgets
Could you please help me solve this problem?
Upvotes: 2
Views: 15756
Reputation: 91
Solved: The file was corrupted. I tried reinstalling pyqt:
python3 -m pip install --upgrade --force-reinstall PyQt5
It works like before now.
Thanks to u/socal_nerdtastic on Reddit for the solution
Upvotes: 4