python中没有pygal_il8n模块的问题

今天在python学习中绘制世界地图过程中碰到了如下的问题:

ModuleNotFoundError: No module named 'pygal.il8n'

解决方法为:

step1:安装pygal_maps_world模块

在终端(cmd)中输入pip install pygal_maps_world   ,下载安装

step2:修改代码为

import pygal
from pygal.maps.world import COUNTRIES
#from pygal.il8n import COUNTRIES
for country_code in sorted(COUNTRIES.keys()):
    print(country_code,COUNTRIES[country_code])

运行成功!

你可能感兴趣的:(教程)