LoginSignup
5
5

More than 5 years have passed since last update.

Jupyter Notebookで複数カーネル(Mac)

Last updated at Posted at 2018-05-19

自分用メモ

仮想環境使ってkernelの追加方法

MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)
プロセッサ 2.5GHz Intel Core i7
メモリ   8GB 2133 MHz LPDDR3

実環境でAnacondaが入っている前提で
https://www.anaconda.com/download/

Jupyter Notebookで使えるカーネルの確認

$ jupyter kernelspec list
python2    /Users/(ユーザ名)/anaconda2/share/jupyter/kernels/python2

python2系のkernelを追加するとき

$ conda create -n py27 python=2.7 notebook ipykernel
$ source activate py27
$ ipython kernel install --user

カーネルの情報は/Users/(ユーザ名)/Library/Jupyter/kernels/python2/kernel.jsonにある

$ cat /Users/(ユーザ名)/Library/Jupyter/kernels/python2/kernel.json
{
 "display_name": "Python 2",
 "language": "python",
 "argv": [
  "/Users/(ユーザ名)/anaconda2/envs/py27/bin/python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ]

python3系のkernelを追加するとき

$ conda create -n py36 python=3.6 notebook ipykernel
$ source activate py36
$ ipython kernel install --user

kernelの情報は上と同様

Jupyter Notebookで使えるカーネルの再確認

$ jupyter kernelspec list
python2    /Users/(ユーザ名)/Library/Jupyter/kernels/python2
python3    /Users/(ユーザ名)/Library/Jupyter/kernels/python3

Jupyter Notebookの起動

$ jupyter notebook

参考サイト
https://stackoverflow.com/questions/30492623/using-both-python-2-x-and-python-3-x-in-ipython-notebook

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5