解决:AttributeError: module 'pygal' has no attribute 'Worldmap' 问题
将原来导入的模块改成这样子的
import pygal_maps_world.maps
wm = pygal_maps_world.maps.World()
完整 代码
import pygal
import pygal_maps_world.maps
wm = pygal_maps_world.maps.World()
# wm = pygal.Worldmap()
wm.title = 'North, Central and South America'
wm.add('North America',['ca','mx','us'])
wm.add('South America',['ar','bo','br','gt','hn','ni','pa','sv'])
wm.add('South America', ['ar', 'bo', 'br', 'cl', 'co', 'ec', 'gf', 'gy', 'pe', 'py', 'sr', 'uy', 've'])
wm.render_to_file('americas.svg')
效果图