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:
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.