How to change jupyter kernel from Python 2 to python 3?

How to change jupyter kernel from Python 2 to python 3?

b’

https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-python.html n

n

Follow the link for managing python. If you use python 2, then install python 3 by using this command.

n

conda create -n py36 python=3.6 anacondan

n

After installing python 3, activate python 3 by using this command

n

activate py36 n

n

Then open jupyter notebook, you will find python on your kernel.

You can do this with the following steps:

n

    n

  1. conda create -n py36 python=3.6 ipykernel #Replace 3.6 with desired version.

  2. n

  3. To activate installed jupyter kernal you need run, source activate py36

  4. n

  5. python -m ipykernel install --user

  6. n

  7. The interesting part: if you want to switch between kernels (py2-py3) in the same notebook, you need to run, conda install nb_conda

  8. n

n

However, if at any point you realize that some of the modules are not available, for that you need to check Anaconda Python version.

n

python - versionn

n

if it is not python 3.x, you need to run

n

conda create -n py36 python=3.6 anacondansource active py36n

n

I hope it helps and enjoy switching python versions in the same notebook. You can try to print something in both python2 and python 3.

How to change jupyter kernel from Python 2 to python 3?

In case you installed the python/jupyter with anaconda, simply update the python from 2.* to 3.*

Leave a Reply

Your email address will not be published.