运行QT程序时报错
报错内容为:
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
原因
安装pyqt5第三方库时,在使用时未添加插件目录。
解决方案
先找到虚拟环境中QT插件的目录:
D:\pythonpro\learn_python38\基于深度学习的异常流量检测\venv\Lib\site-packages\PyQt5\Qt5\plugins
1、在terminal上运行
则先设置QT_PLUGIN_PATH
路径:
激活虚拟环境后执行:
set QT_PLUGIN_PATH=D:\pythonpro\learn_python38\基于深度学习的异常流量检测\venv\Lib\site-packages\PyQt5\Qt5\plugins