【问题解决方案】AttributeError: module 'pygal' has no attribute 'Worldmap'
《Python编程:从入门到实践》- 16章-16.2.5制作世界地图
import pygal 后报如标题的error
参考CSDN 解决:AttributeError: module 'pygal' has no attribute 'Worldmap' 问题
# from pygal_maps_world.i18n import COUNTRIES
import pygal
wm = pygal.Worldmap() # 调用一个Worldmap实例
wm.title = 'North, Central, and South America'
# 方法add():接受一个标签和一个列表,后者包含要突出的国家的国别码
# 每次调用add()将为指定的国家选择一种新颜色,并在图表左边显示该颜色和指定的标签
wm.add('North America', ['ca','mx','us'])
wm.add('Central America',['bz','cr','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')
# NameError: name 'pygal' is not defined
# 错误位置:wm = pygal.Worldmap()
# 针对这个错误,尝试import pygal,后依然报错:
# AttributeError: module 'pygal' has no attribute 'Worldmap'
解决:
报错是因为之前的模块已经不存在了,需要将前两行代码代替为:
import pygal_maps_world.maps
wm = pygal_maps_world.maps.World()
再运行,问题解决
END
【问题解决方案】AttributeError: module 'pygal' has no attribute 'Worldmap'的更多相关文章
- 解决Pycharm更新package出现的问题:AttributeError:module 'pip' has no attribute 'main'
很久一段时间没有更新Pycharm当中的package了,今天打开Pycharm点击package更新,发生了错误,AttributeError:module 'pip' has no attribu ...
- AttributeError: 'module' object has no attribute 'gfile'
While running TensorFlow's classify_image, getting AttributeError: 'module' object has no attribute ...
- Python AttributeError: 'Module' object has no attribute 'STARTF_USESHOWINDOW'
夫学须志也,才须学也,非学无以广才,非志无以成学.--诸葛亮 生活有度,自得慈铭 --杜锦阳 今天新来的同事安装环境遇到个莫名其妙的问题: AttributeError: 'Module' objec ...
- Intel发布神经网络压缩库Distiller:快速利用前沿算法压缩PyTorch模型——AttributeError: module ‘tensorboard' has no attribute 'lazy'
转载自:CSDN Nine-days 近日,Intel 开源了一个用于神经网络压缩的开源 Python 软件包 Distiller,它可以减少深度神经网络的内存占用.加快推断速度及节省能耗.Dis ...
- AttributeError: module 'time' has no attribute 'clock'
在python3.8中flask项目运行报错: AttributeError: module 'time' has no attribute 'clock'解决方案 主要原因是因为python3.8中 ...
- python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?
python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- attributeError:'module' object has no attribute ** 解决办法
写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...
- AttributeError: 'module' object has no attribute 'TornadoAsyncNotifier'
/*************************************************************************** * AttributeError: 'modu ...
随机推荐
- 卷积神经网络(Convolutional Neural Network,CNN)
全连接神经网络(Fully connected neural network)处理图像最大的问题在于全连接层的参数太多.参数增多除了导致计算速度减慢,还很容易导致过拟合问题.所以需要一个更合理的神经网 ...
- Session的使用与Session共享问题
Session的使用与Session共享问题 Session方法 getId():获取sessionId,这个id不一定是数字,比方说它用字符串来表示唯一标识,所以它返回值是String; boole ...
- 微信公众号开发C#系列-4、获取接口调用凭证
概述 获取接口调用凭证实质就是获取access_token.在微信接口开发中,许多服务的使用都离不开Access Token,Access Token相当于打开这些服务的钥匙,正常情况下会在7200秒 ...
- 4.3dotnet watch run「深入浅出ASP.NET Core系列」
希望给你3-5分钟的碎片化学习,可能是坐地铁.等公交,积少成多,水滴石穿,谢谢关注. dotnet run的麻烦 如果您使用的是vs code进行跨平台开发,那么dotnet watch run对你的 ...
- c#导出文件,文件名中文乱码解决方法
public string clFielName(string fileName) { System.Web.HttpContext curContext = System.Web.HttpConte ...
- [转]Node.js 应用:Koa2 使用 JWT 进行鉴权
本文转自:https://www.cnblogs.com/linxin/p/9491342.html 前言 在前后端分离的开发中,通过 Restful API 进行数据交互时,如果没有对 API 进行 ...
- 系统设计Design For Failure思想
系统设计Design For Failure思想 Complex systems fail in spectacular ways. Failure isn't a question of if, b ...
- 责任链模式 职责链模式 Chain of Responsibility Pattern 行为型 设计模式(十七)
责任链模式(Chain of Responsibility Pattern) 职责链模式 意图 使多个对象都有机会处理请求,从而避免请求的发送者和接受者之间的耦合关系 将这些对象连接成一条链,并沿着这 ...
- No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android"
安装完NDK的时候出现了这个错误,网上的办法是下载旧版的NDK,将其中的toolchain复制到新版的NDK中. 但其实不用这么麻烦. 经过对新版NDK的研究,发现NDK的更新记录里有一段话 This ...
- 基于Netty 实现简单的私有协议
原文链接 基于Netty 实现简单的私有协议 代码仓库地址 基于Netty 实现简单的私有协议 在学习了Netty的不同的编码器和解码器之后,我们可以通过编解码器实现简单的自定义协议,这个自定义的协议 ...