当前位置: 首页 > 编程笔记 >

解决pyecharts在jupyter notebook中使用报错问题

秦博达
2023-03-14
本文向大家介绍解决pyecharts在jupyter notebook中使用报错问题,包括了解决pyecharts在jupyter notebook中使用报错问题的使用技巧和注意事项,需要的朋友参考一下

建议html" target="_blank">下载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中使用报错问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持小牛知识库。

 类似资料:
  • 本文向大家介绍解决SpringMVC使用@RequestBody注解报400错误的问题,包括了解决SpringMVC使用@RequestBody注解报400错误的问题的使用技巧和注意事项,需要的朋友参考一下 一般使用@RequestBody接收的时候报400都是传入的json字符串和对应封装的对象不对应造成的 首先要注意 封装的对象中的字段类型有没有Date类型或者int等类型的,如果有的话,在s

  • 本文向大家介绍解决使用export_graphviz可视化树报错的问题,包括了解决使用export_graphviz可视化树报错的问题的使用技巧和注意事项,需要的朋友参考一下 在使用可视化树的过程中,报错了。说是‘dot.exe'not found in path 原代码: 报错信息: 解决方法: 先使用安装pydot: 然后再下载Graphviz(http://www.graphviz.org

  • 本文向大家介绍解决mybatis case when 报错的问题,包括了解决mybatis case when 报错的问题的使用技巧和注意事项,需要的朋友参考一下 在mybatis中使用case when进行条件筛选判断时遇到 Failed to process, please exclude the tableName or statementId. 这样的报错信息,报错的信息是语法错误 但是我

  • 本文向大家介绍解决Python安装cryptography报错问题,包括了解决Python安装cryptography报错问题的使用技巧和注意事项,需要的朋友参考一下 错误一: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_

  • 为什么显示ValueError: too many values to unpack (expected 2)? 无

  • 本文向大家介绍在pycharm中使用matplotlib.pyplot 绘图时报错的解决,包括了在pycharm中使用matplotlib.pyplot 绘图时报错的解决的使用技巧和注意事项,需要的朋友参考一下 This application failed to start because it could not find or load the Qt platform plugin “win