python程序报错“This application failed to start because it could not find or load the Qt Platforms”

问题:在pycharm中运行程序时出现“This application failed to start because it could not find or load the Qt Platforms”错误

python程序报错“This application failed to start because it could not find or load the Qt Platforms”_第1张图片

解决:

1.首先检查代码加载了哪些库:

因为这个问题看网上帖子各不一样,说明不一定是同一个原因,我的办法是删掉与某个库有关的那句代码再运行如果不报错说明就是这个库出了问题;

比如

import math
import cv2
import numpy as np
from matplotlib import pyplot as plt

注释与matplotlib库有关的代码后,代码不报错,说明是matplotlib有问题;

2.卸载: python uninstall  matplotlib

3.重装:python install matplotlib

你可能感兴趣的:(python)