安裝
-
下載源碼 https://github.com/pyecharts/pyecharts 解壓縮。
-
python setup.py install --prefix your_install_dir
如果報jinja2、prettytable、simplejson 等庫不存在,需要先安裝依賴庫,或將這些庫加到$PYTHONPATH后再執行install。
離線使用
v1.0之后,pyecharts默認使用在線的js asset文件,如果沒聯網會導致生成html打開后是空白。離線使用需要指定為本地的assets路徑。
-
下載assets https://github.com/pyecharts/pyecharts-assets 解壓縮。
-
在腳本里指定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