AttributeError: module 'pygal' has no attribute 'Worldmap'

AttributeError: module 'pygal' has no attribute 'Worldmap'

我正在尝试:

import pygal
wm = pygal.Worldmap()

但它引发了:

AttributeError: module 'pygal' has no attribute 'Worldmap'

谁能告诉我问题出在哪里?

据我所知,您可能正在查看旧文档。最近的 docs 声明您首先需要安装地图插件:

pip install pygal_maps_world

然后将其用作:

import pygal
mm = pygal.maps.world.World()