pyecharts运行后产生的html文件用浏览器打开空白

引用:https://github.com/pyecharts/pyecharts/issues/503

使用logging日志打印代码错误:

#coding=utf-8
#from __future__ import unicode_literals
import logging
import logging.config


logging.basicConfig(
    format='%(name)s:%(lineno)d - %(levelname)s - %(message)s',
    level=logging.DEBUG)



from pyecharts import Bar

bar = Bar("我的第一个图表", "这里是副标题")
bar.add("服装", ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], [5, 20, 36, 10, 75, 90])
bar.render()

运行错误:说明是因为库jupyter_echarts_pypkg未安装导致,这个库包含包含所有图表组件

lml.plugin:328 - DEBUG - declare 'pyecharts_js_extension' plugin manager
lml.loader:54 - DEBUG - scanning for plugins...
lml.utils:51 - ERROR - failed to import jupyter_echarts_pypkg
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\lml\utils.py", line 43, in do_import
plugin_module = import(plugin_module_name)
ModuleNotFoundError: No module named 'jupyter_echarts_pypkg'
lml.loader:81 - DEBUG - jupyter_echarts_pypkg
lml.loader:82 - DEBUG - No module named 'jupyter_echarts_pypkg'
lml.loader:84 - DEBUG - scanning done

Process finished with exit code 0

当然,包含所有图表组件我们也可以去http://echarts.baidu.com/download.html下载echarts.min.js

然后在html文件中添加 ,也能解决界面空白问题。

你可能感兴趣的:(python)