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 found that this was being caused by having the MiKTeX binaries in my PATH variable; and the wrong Qt dll's were being found. I just needed to re-arrange the PATH entries.
(Dependency Walker is such a useful tool.)
If you want to visualize your matplotlibs in an alternative way, use a different backend that generates the graphs, charts etc.
import matplotlib
matplotlib.use('TKAgg')
This worked for me.
Copy the folder
\Anaconda3\Library\plugins\platforms
to
\$\
where $
is your project interpreter folder. For example:
"\project\anaconda_env\Scripts\"
because PyCharm calls the python.exe in this folder, not the one in \Anaconda3
.
I had the same issue with Qt 5.9 example btscanner.exe. What works in my case is:
Run from command prompt windeployqt.exe as follow: c:\qt\qt5.9.0\msvc2015\bin\windeployqt c:\temp\BlueTouth /* windeplyqt is the standard Qt tool to packet your application with any needed libraries or extra files and ready to deploy on other machine */
Result should be something like that:
C:\temp\BlueTouth\btscanner.exe 32 bit, release executable
Adding Qt5Svg for qsvgicon.dll
Skipping plugin qtvirtualkeyboardplugin.dll due to disabled dependencies.
Direct dependencies: Qt5Bluetooth Qt5Core Qt5Gui Qt5Widgets
All dependencies : Qt5Bluetooth Qt5Core Qt5Gui Qt5Widgets
To be deployed : Qt5Bluetooth Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Warning: Cannot find Visual Studio installation directory, VCINSTALLDIR is not set.
Updating Qt5Bluetooth.dll.
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating libGLESV2.dll.
Updating libEGL.dll.
Updating D3Dcompiler_47.dll.
Updating opengl32sw.dll.
Patching Qt5Core.dll...
Creating directory C:/temp/BlueTouth/iconengines.
Updating qsvgicon.dll.
Creating directory C:/temp/BlueTouth/imageformats.
Updating qgif.dll.
Updating qicns.dll.
Updating qico.dll.
Updating qjpeg.dll.
Updating qsvg.dll.
Updating qtga.dll.
Updating qtiff.dll.
Updating qwbmp.dll.
Updating qwebp.dll.
Creating directory C:/temp/BlueTouth/platforms.
Updating qwindows.dll.
Creating C:\temp\BlueTouth\translations...
Creating qt_bg.qm...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_da.qm...
Creating qt_de.qm...
Creating qt_en.qm...
Creating qt_es.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_gd.qm...
Creating qt_he.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ko.qm...
Creating qt_lv.qm...
Creating qt_pl.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_uk.qm...
These are all of the files and folders need to run btscanner.exe on this or another machine. Just copy whole folder on other machine and run the file.
If you are running PyQt5 and PySide2, this solved the problem for me:
Copy the following files:
\Anaconda3\Lib\site-packages\PySide2\plugins\platforms\qminimal.dll
\Anaconda3\Lib\site-packages\PySide2\plugins\platforms\qoffscreen.dll
\Anaconda3\Lib\site-packages\PySide2\plugins\platforms\qwindows.dll
to:
\Anaconda3\Library\plugins\platforms\
Just add a system variable:
QT_QPA_PLATFORM_PLUGIN_PATH
and set its value to
C:\Python34\Lib\site-packages\PyQt4\plugins\platforms
Voilà. Done