[英]%matplotlib inline error in python 3.6.2
如何在我的電腦上運行代碼?
我試圖在我的計算機上運行我的代碼,但不知何故出現錯誤:
文件“catcode.py”,第 9 行
%matplotlib inline
^
SyntaxError: invalid syntax
我使用的是macOS Sierra 10.12.6
、MacBook Pro(Retina,13 英寸,2015 年初)、2.9 GHz Intel Core macOS Sierra 10.12.6
GB 1867 MHz DDR3、Intel Iris Graphics 6100 1536 MB。
我也通過終端使用python 3
:
Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] 在達爾文
這是我擁有的軟件包列表:
['appnope==0.1.0', 'cycler==0.10.0', 'decorator==4.1.2', 'h5py==2.7.1', 'ipython-genutils==0.2.0', 'ipython ==6.2.1'、'絕地==0.11.0'、'matplotlib==2.1.0'、'numpy==1.13.3'、'parso==0.1.0'、'pexpect==4.2.1 ', 'pickleshare==0.7.4', 'pip==9.0.1', 'prompt-toolkit==1.0.15', 'ptyprocess==0.5.2', 'pygments==2.2.0', ' pyparsing==2.2.0'、'python-dateutil==2.6.1'、'pytz==2017.2'、'scikit-learn==0.19.0'、'scipy==0.19.1'、'setuptools== 28.8.0', 'simplegeneric==0.8.1', 'six==1.11.0', 'traitlets==4.3.2', 'wcwidth==0.1.7']
%matplotlib inline
是一個“神奇的函數”,用於裝飾 Jupyter 筆記本中的單元格。
您不能在jupyter notebook
和ipython console
之外使用它
對您來說最好的解決方案可能是注釋掉該行; 除此之外,您可以安裝 jupyter 和 ipython。
'exec(%matplotlib inline)'
應該可以正常工作。 我已經在我的系統上測試過它,它在 python3.6 上運行良好
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.