AttributeError:模块“squarify”没有属性“plot”

2024-09-28 19:21:25 发布

您现在位置:Python中文网/ 问答频道 /正文

创建树映射的一段代码以前有效,现在不再有效。我使用的Spyder IDE是我与Anaconda一起安装的

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并重新安装笛卡尔来修复这个错误。但是,初始squairy错误仍然存在


Tags: 代码importinfoplotmatplotlibdist错误group