解決pyecharts在jupyter notebook中使用報錯問題
建議下載pyecharts(0.5.xx)版本,如果使用 pip install pyecharts 默認安裝V1版本(如1.7.1)會出現(xiàn)如下報錯:
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 #顯示右側(cè)的工具欄 # bar.show_config() # 打印所有參數(shù) 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 ‘a(chǎn)dd'
解決辦法:卸載、安裝舊版本
pip install pyecharts==0.5.10 -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn
如果安裝時報錯(mac系統(tǒng)):
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中使用報錯問題就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Python數(shù)據(jù)類型--字典dictionary
這篇文章主要介紹了Python數(shù)據(jù)類型字典dictionary,字典是另一種可變?nèi)萜髂P?,且可存儲任意類型對象。下面詳細?nèi)容需要的小伙伴可以參考一下,希望對你有所幫助2022-02-02解決win10 vscode 無法激活python 虛擬環(huán)境的問題
這篇文章主要介紹了win10 vscode 無法激活python 虛擬環(huán)境的解決辦法,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-10-10python使用Psutil模塊實現(xiàn)獲取計算機相關(guān)信息
psutil 是一個跨平臺的庫,用于獲取進程和系統(tǒng)運行狀態(tài)的信息,這篇文章主要為大家詳細介紹了python如何調(diào)用psutil模塊實現(xiàn)獲取計算機相關(guān)信息,有需要的小伙伴可以了解下2023-11-11python+opencv像素的加減和加權(quán)操作的實現(xiàn)
這篇文章主要介紹了python+opencv像素的加減和加權(quán)操作的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-07-07