matplotlib.pyplot画图报QT错误
程序员文章站
2022-03-29 19:25:20
...
1、卸载了python2.7,安装了Anaconda3,用python画图时,竟然报Qt错误
按照别人的说法是Anaconda的问题,更新qt
conda install qt
或者
conda update pyqt
但是仍然无济于事
查看官方matplotlib 安装尝试更新matplotlib
python -m pip install -U pip 更新pip
python -m pip install -U matplotlib 更新matplotlib
测试:
#coding:utf-8
import matplotlib.pyplot as plt
labels='apple','banana','orange','pear'
sizes=20,10,30,40
colors='yellowgreen','gold','lightskyblue','lightcoral'
#banana和其它有间隙
explode=0,0.1,0,0
plt.pie(sizes,explode=explode,labels=labels,colors=colors,autopct='%.1f%%',shadow=True,startangle=50)
#轴对称,圆
plt.axis('equal')
plt.show()