问题描述:
嵩天老师课上代码运行时出现两个问题:
1、无Qt平台插件错误(解决了很久):This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.;
2、参数不对应ValueError: The number of FixedLocator locations (7), does not match the number of ticklabels (6).
代码:
问题1:
问题解决:
问题1:一开始以为是pyqt5安装有问题,尝试卸载重新安装,文件安装未解决,逐行检查代码发现问题出在调用matplotlib库代码行,搜索找到其他博主解决方法,即新建系统变量:解决This application failed to start because no Qt platform plugin could be initialized的办法_KB_talk的博客-CSDN博客https://blog.csdn.net/qq_43903004/article/details/113878306
划重点:变量值需要输入plugin路径,首先你要能找到你的python文件夹位置,然后依次以下路径,将路径地址复制到变量值位置,变量名我按原博主写的QT_PLUGIN_PATH
\Python\Python310(首先要知道这个位置)\Lib\site-packages\PyQt5\Qt5\plugins
至此问题1 解决
问题2:网上回答这个问题的比较多,我是参考下面这篇文章解决的
(1)添加绿色行代码:radar_labels = np.concatenate((radar_labels, [radar_labels[0]]))
(2)删除红色行代码:data = np.concatenate((data, [data[0]]))
angles = np.concatenate((angles, [angles[0]]))