I am getting the error \"could not find or load the Qt platform plugin windows\" while using matplotlib in PyCharm.
How can I solve this?
I solved it by:
Adding a path:
\Anaconda3\Lib\site-packages\PyQt5\Qt\bin to PATH.
Setting an environment variable:
QT_PLUGIN_PATH
as \Anaconda3\Lib\site-packages\PyQt5\Qt\plugins
or \Anaconda3\Library\plugins
.
Also, you can try:
pyqt = os.path.dirname(PyQt5.__file__)
os.environ['QT_PLUGIN_PATH'] = os.path.join(pyqt, "Qt/plugins")
I tried the following at Anaconda's prompt, and it solved this problem:
conda remove qt
conda remove pyqt
conda install qt
conda install pyqt
copy the plugins from PySide2 and paste and overwrite the existing plugins in Miniconda worked for me.
(base) C:\ProgramData\Miniconda3\Lib\site-packages\PySide2\plugins\platforms>copy *.dll C:\ProgramData\Miniconda3\Library\plugins\platforms\