動作環境
Ubuntu 16.04 LTS desktop amd64
IPython 5.5.0 -- An enhanced Interactive Python.
Jupyter NotebookでPython3のカーネルはインストール済み。
codeとエラー
Python3を選択して実装。
polarAndAzimuthCalc_171207.ipynb
import numpy as np
print('hello', end='')
error
File "<ipython-input-1-ae4c065c97a5>", line 6
print('hello', end='')
^
SyntaxError: invalid syntax
Python2のprintになっている。
About
JupyterのAboutは以下となっている。
The server is running on this version of Python:
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609]
Current Kernel Information:
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
Type "copyright", "credits" or "license" for more information.
IPython 5.5.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
対策
answered Jul 22 '16 at 0:54
Jana
以下を実行したところ、Python3のprintになった。
python3 -m pip install ipykernel
python3 -m ipykernel install --user
JupyterのAboutの「Current Kernel Information:」は以下となった。
Current Kernel Information:
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.