echarts
ECharts,一個純 Javascript 的圖表庫,可以流暢的運行在 PC 和移動設備上,兼容當前絕大部分瀏覽器,提供直觀,生動,可交互,可高度個性化定制的數據可視化圖表。
安裝 python-echarts
最先我按照文檔的方法安裝:
pip install python-echarts
安裝沒有問題,但我這里導入時遇到了ImportError
In [1]: from echarts import Echart, Bar, Legend, Axis, Pie
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-751ca5ea3986> in <module>()
----> 1 from echarts import Echart, Bar, Legend, Axis, Pie
ImportError: cannot import name 'Echart'
發現import echarts沒有問題,但實際echarts里是沒有東西的
In [2]: import echarts
In [3]: dir(echarts)
Out[3]:
['__builtins__',
'__cached__',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__path__',
'__spec__',
'__version__']
解決辦法
下載echart的 tgz包(點我下載)
wget https://pypi.python.org/packages/ad/d7/258cbe09217d62c225e4f797112493f87382a40d7c4679768ae45ed9d78e/echarts-python-0.1.3.tar.gz#md5=bb5a1ddd717f95d43da00cf1f9bf2f17
注意,如果已經用pip install python-echarts安裝echarts,要先卸載再安裝
pip uninstall python-echarts
解壓tgz包,切換到目錄下執行安裝
tar -zxf echarts-python-0.1.3.tar.gz
cd echarts-python-0.1.3
python setup.py install
這樣就安裝成功了。