问题
学习d2l,在jupyter notebook中使用的%matplotlib inline
,plot时报错:
TypeError: print_svg() got an unexpected keyword argument ‘orientation’
换了很多版本也没有用。
解决
是ipython 跟 matplotlib不兼容,matplotlib官方提供了解决方案:使用ipympl。
- 在python环境中安装ipympl:
pip install ipympl
- jupyter notebook中替换inline为ipympl:
%matplotlib ipympl
解决。附上ipympl Doc:matplotlib-ipympl