jupyter %matplotlib inline報錯TypeError:print_svg() got an unexpected keyword argument‘orientation‘問題
更新時間:2024年09月12日 12:58:21 作者:Zer0_Wu
在Jupyter Notebook使用matplotlib時出現(xiàn)TypeError錯誤,一般是由于ipython和matplotlib版本不兼容造成的,通過安裝ipympl并將魔法命令替換為%matplotlib ipympl,可以解決這個問題
問題
學習d2l,在jupyter notebook中使用的%matplotlib inline
plot時報錯:
TypeError: print_svg() got an unexpected keyword argument ‘orientation’
換了很多版本也沒有用。
解決
是ipython 跟 matplotlib不兼容,matplotlib官方提供了解決方案:使用ipympl。
- 在python環(huán)境中安裝ipympl:
pip install ipympl
- jupyter notebook中替換inline為ipympl:
%matplotlib ipympl
解決
附上ipympl Doc:matplotlib-ipympl
總結
以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
Python實戰(zhàn)之生成有關聯(lián)單選問卷
這篇文章主要為大家分享了一個Python實戰(zhàn)小案例——生成有關聯(lián)單選問卷,并且能根據問卷總分數(shù)生成對應判斷文案結果,感興趣的可以了解一下2023-04-04