mac中jupyter notebook python2和3共存

Kernels for Python 2 and 3

If you’re running Jupyter on Python 3, you can set up a Python 2 kernel after checking your version of pip is greater than 9.0:

python2 -m pip --version

Then install with
python2 -m pip install ipykernel
python2 -m ipykernel install --user

Or using conda, create a Python 2 environment:

conda create -n ipykernel_py2 python=2 ipykernel
source activate ipykernel_py2    # On Windows, remove the word 'source'
python -m ipykernel install --user

Note

IPython 6.0 stopped support for Python 2, so installing IPython on Python 2 will give you an older version (5.x series).

If you’re running Jupyter on Python 2 and want to set up a Python 3 kernel, follow the same steps, replacing 2 with 3.

The last command installs a kernel spec file for the current python installation. Kernel spec files are JSON files, which can be viewed and changed with a normal text editor.

原文:https://ipython.readthedocs.io/en/stable/install/kernel_install.html 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章