您的位置:首页 > 编程语言 > Python开发

Install Both Python2 and Python3 in Jupyter

2017-06-26 15:53 267 查看
When we install jupyter by Conda, it offers python2 or python3 version. Such as me, I installed conda with python2. But in some cases, the codes are based on python3, so we need both python2 and python3 in one jupyter, and we can choose which version we need simply.

I search google for some results, refers to:

https://stackoverflow.com/questions/30492623/using-both-python-2-x-and-python-3-x-in-ipython-notebook

When the version of Anaconda above 4.1.0, it can easily install two python kernels.

Check Anaconda version

In my server, the version satisfies the requirements.

[~]# conda -V
conda 4.2.13


Install python kernel

Python2

conda create -n py36 python=2.7 ipykernel


Python3

conda create -n py36 python=3.6 ipykernel


Register kernels

Python 2

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


Python 3

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


Finish

We can see the notebook with both python2 and python3.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python jupyter