python——关于“霍兰德人格分析雷达图”代码运行错误解决

问题描述:

嵩天老师课上代码运行时出现两个问题:

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博客icon-default.png?t=M4ADhttps://blog.csdn.net/qq_43903004/article/details/113878306

划重点:变量值需要输入plugin路径,首先你要能找到你的python文件夹位置,然后依次以下路径,将路径地址复制到变量值位置,变量名我按原博主写的QT_PLUGIN_PATH

\Python\Python310(首先要知道这个位置\Lib\site-packages\PyQt5\Qt5\plugins

 至此问题1 解决

问题2:网上回答这个问题的比较多,我是参考下面这篇文章解决的

霍兰德人格分析雷达图生成报错ValueError:he number of FixedLoca和AttributeError: ‘Text‘ object has no property ‘frac‘_ff99717的博客-CSDN博客霍兰德人格分析雷达图生成报错ValueError:he number of FixedLoca和AttributeError: 'Text' object has no property 'frac'报错为:ValueError: The number of FixedLocator locations (7), usually from a call to set_ticks, does not match the number of ticklabels (6).则只需删除红色矩形框1中的内容如https://blog.csdn.net/a147225/article/details/112674969关于7和6的问题有两种解决方案:

(1)添加绿色行代码:radar_labels = np.concatenate((radar_labels, [radar_labels[0]]))

(2)删除红色行代码:data = np.concatenate((data, [data[0]]))
angles = np.concatenate((angles, [angles[0]]))

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值