温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

pyecharts在jupyter notebook中使用报错怎么办

发布时间:2020-08-01 09:37:33 来源:亿速云 阅读:457 作者:小猪 栏目:开发技术

小编这次要给大家分享的是pyecharts在jupyter notebook中使用报错怎么办,文章内容丰富,感兴趣的小伙伴可以来了解一下,希望大家阅读完这篇文章之后能够有所收获。

建议下载pyecharts(0.5.xx)版本,如果使用 pip install pyecharts 默认安装V1版本(如1.7.1)会出现如下报错:

1、Bar模块导入问题

from pyecharts import Bar

报错:

cannot import name ‘Bar'

解决办法:

from pyecharts.charts import Bar

2、Bar 使用报错

from pyecharts import Bar
bar =Bar("我的第一个图表", "这里是副标题") #标题
bar.add("服装", #标签
  ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],#x坐标
  [5, 20, 36, 10, 75, 90]) #y坐标
# is_more_utils = True #显示右侧的工具栏
# bar.show_config() # 打印所有参数
bar.render('my_first_chart.html')#保存图列
bar

报错:

TypeError: init() takes from 1 to 2 positional arguments but 3 were given

尝试注释掉报错行:

#bar =Bar("我的第一个图表", "这里是副标题")

还会有新的报错:‘Bar' object has no attribute ‘add'

解决办法:卸载、安装旧版本

pip install pyecharts==0.5.10 -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn

如果安装时报错(mac系统):

Failed building wheel for dukpy
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1

解决办法:

1、安装xcode

xcode-select --install

2、然后再安装pyecharts-0.5.10

3、安装成果后重启jupyter notebook即可

看完这篇关于pyecharts在jupyter notebook中使用报错怎么办的文章,如果觉得文章内容写得不错的话,可以把它分享出去给更多人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI