pyecharts离线使用说明

安装

  1. 下载源码 https://github.com/pyecharts/pyecharts 解压缩。

  2. python setup.py install --prefix your_install_dir

    如果报jinja2、prettytable、simplejson 等库不存在,需要先安装依赖库,或将这些库加到$PYTHONPATH后再执行install。

离线使用

v1.0之后,pyecharts默认使用在线的js asset文件,如果没联网会导致生成html打开后是空白。离线使用需要指定为本地的assets路径。

  1. 下载assets https://github.com/pyecharts/pyecharts-assets 解压缩。

  2. 在脚本里指定asset为上述目录

    from pyecharts.globals import CurrentConfig, OnlineHostType
    CurrentConfig.ONLINE_HOST = "/xx/pyecharts-assets-master/assets/"
    

Warning消除

version 1.8.0 更新之后控制台会出现 PendingDeprecationWarning 的提示,如需关闭,请在脚本加入如下代码:

from pyecharts.globals import WarningType
WarningType.ShowWarning = False

作者:LessIsMorer

Email:wenfeiexe@foxmail.com

水平有限,文中错误不妥在所难免,欢迎批评指正。文章将不定期修改完善。转载请注明出处,谢谢!

原文地址:https://www.cnblogs.com/gaowf/p/13571335.html