一段用于创建以前有效的树形图的代码不再有效。我正在使用与 Anaconda 一起安装的 Spyder IDE。
import matplotlib.pyplot as plt
import squarify
squarify.plot(
sizes=[13,22,35,5],
label=["group A", "group B", "group C", "group D"],
)
plt.axis('off')
plt.show()
当我运行代码时,它会引发以下错误:
AttributeError: module 'squarify' has no attribute 'plot'
我不知道我有什么更改导致代码不再工作。我可以运行其他 matplotlib
*** 更新 *** 我找到了一个建议我应该运行的来源pip3 install -U matplotlib
,这会产生另一个错误
WARNING: Error parsing requirements for descartes: [Errno 2] No such file or directory: 'c:\\users\\USER\\anaconda3\\envs\\uba\\lib\\site-packages\\descartes-1.1.0.dist-info\\METADATA'
我能够通过删除文件夹descartes-1.1.0.dist-info
并重新安装笛卡尔来解决此错误。然而,最初的 squary 错误仍然存在。