python: This application failed to stat could not find or load the Qt platform plugin “windows”

there was a problem that the graphics window could not be used when drawing with matplotlib today:

This application failed to start because it could not find or load the Qt platform plugin “windows”
in “”.

Reinstalling the application may fix this problem.

That’s the case with

.

I had no problem using it before, but suddenly today, I think it must be because I have just reinstalled some packages or library files of the system that have not been installed, or the environment is configured.

because python was installed before, then install whatever package you need, step by step install over, after reinstall the system for convenience, install anaconda, so as not to rely on the environment too much trouble. However, there was a problem: the application failed to start because it could not find or load the QT platform plug-in “Windows” .

looked up some related column problems on the Internet, and finally solved the problem.

plug-ins cannot be found or loaded, in two cases 1: no relevant software or libraries are installed. 2: Yes, but there is no associated path at call time.

I looked at Qt’s installation package:

is all there is, so the problem should be the path setting. There are many related problems on the Internet, the main one is to add it in the environment variable, the steps are as follows:

variable name: QT_QPA_PLATFORM_PLUGIN_PATH

plugins variable value: D:\Anaconda\ PKGS \qt-5.6.2-vc14h6f8c307_12\Library\plugins (my path, installation location changed, changed)

remember that it’s the qt plugins path.

if the problem is the above, then 90% of the solution is like this. At the beginning, I also added the variable value wrong, so I failed several times, but as long as you find the right path, you can solve ( after every change in the variable remember to restart the software, run again, otherwise no change ).

Read More: