这个错误通常是因为 matplotlib 版本太老导致的。您可以尝试更新 matplotlib 版本来解决此问题。您可以使用以下命令来更新 matplotlib:

pip install --upgrade matplotlib

如果更新后仍然出现此错误,请尝试使用以下导入语句:

from mpl_toolkits.mplot3d import Axes3D

并将代码中的 Axes3dsubplot 替换为 Axes3D。例如:

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.set_box_aspect([1,1,1])

应改为:

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.set_box_aspect([1,1,1])
VASPkit 报错 'AttributeError: Axes3dsubplot' object has no attribute 'set_box_aspect' 解决方法

原文地址: https://www.cveoy.top/t/topic/lOzI 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录