close

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

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to change jupyter kernel from Python 2 to python 3 in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

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

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

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

  2. change jupyter kernel from Python 2 to python 3

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

Method 1

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

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

conda create -n py36 python=3.6 anaconda

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

activate py36 

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

Method 2

You can do this with the following steps:

  1. conda create -n py36 'python=3.6' ipykernel #Replace 3.6 with desired version.
  2. To activate installed jupyter kernal you need run, source activate py36
  3. python -m ipykernel install --user
  4. The interesting part: if you want to switch between kernels (py2-py3) in the same notebook, you need to run, conda install nb_conda

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

python - version

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

conda create -n py36 python=3.6 anaconda
source active py36

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.

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read