%matplotlib inline命令出现get_ipython().magic错误

今天使用seaborn库,使用anaconda中的jupyter notebook编写代码。

为了让图直接在notebook中直接显示,使用了如下代码:

%matplotlib inline#让图直接在notebook上面显示

出现了如下错误:

get_ipython().magic(u'matplotlib inline#\u8ba9\u56fe\u76f4\u63a5\u5728notebook\u4e0a\u9762\u663e\u793a')

一开始以为是没有安装某个库,所以就使用pip install ipython/pip install qtconsole,但是重新运行代码还是一样的错误。后来发现是因为我的注释问题,在%matplotlib inline后面不能接上#打头的注释。

%matplotlib inline
#让图直接在notebook上面显示

这样就行了。

猜你喜欢

转载自blog.csdn.net/u014525494/article/details/80178846