溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

pyecharts在jupyter notebook中使用報(bào)錯(cuò)怎么辦

發(fā)布時(shí)間:2020-08-01 09:37:33 來(lái)源:億速云 閱讀:487 作者:小豬 欄目:開發(fā)技術(shù)

小編這次要給大家分享的是pyecharts在jupyter notebook中使用報(bào)錯(cuò)怎么辦,文章內(nèi)容豐富,感興趣的小伙伴可以來(lái)了解一下,希望大家閱讀完這篇文章之后能夠有所收獲。

建議下載pyecharts(0.5.xx)版本,如果使用 pip install pyecharts 默認(rèn)安裝V1版本(如1.7.1)會(huì)出現(xiàn)如下報(bào)錯(cuò):

1、Bar模塊導(dǎo)入問(wèn)題

from pyecharts import Bar

報(bào)錯(cuò):

cannot import name ‘Bar'

解決辦法:

from pyecharts.charts import Bar

2、Bar 使用報(bào)錯(cuò)

from pyecharts import Bar
bar =Bar("我的第一個(gè)圖表", "這里是副標(biāo)題") #標(biāo)題
bar.add("服裝", #標(biāo)簽
  ["襯衫", "羊毛衫", "雪紡衫", "褲子", "高跟鞋", "襪子"],#x坐標(biāo)
  [5, 20, 36, 10, 75, 90]) #y坐標(biāo)
# is_more_utils = True #顯示右側(cè)的工具欄
# bar.show_config() # 打印所有參數(shù)
bar.render('my_first_chart.html')#保存圖列
bar

報(bào)錯(cuò):

TypeError: init() takes from 1 to 2 positional arguments but 3 were given

嘗試注釋掉報(bào)錯(cuò)行:

#bar =Bar("我的第一個(gè)圖表", "這里是副標(biāo)題")

還會(huì)有新的報(bào)錯(cuò):‘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

如果安裝時(shí)報(bào)錯(cuò)(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即可

看完這篇關(guān)于pyecharts在jupyter notebook中使用報(bào)錯(cuò)怎么辦的文章,如果覺得文章內(nèi)容寫得不錯(cuò)的話,可以把它分享出去給更多人看到。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI