Saurabh
Saurabh

Reputation: 21

How to upgrade python version from python2 to python3 in ubuntu 16.04

I have both the version of python.I have also installed jupyter notebook individually and when i open the jupyter notebook and go to new section it is showing python 2

I want to use python3 for newer packages.So how can we upgrade the python version.

Upvotes: 1

Views: 1983

Answers (2)

Alexey Smirnov
Alexey Smirnov

Reputation: 2613

More systematic approach would be

1 Install virtualenvwrapper

$ pip install virtualenvwrapper
$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.sh
$ mkvirtualenv -p $(which python3) jupyter_notebook

2 Install jupyter in this environment

(jupyter_notebook)$ pip install jupyter

3 Run notebook

(jupyter_notebook)$ jupyter notebook

4 To install new packages don't forget to activate newly created virtual environment

$ workon jupyter_notebook
(jupyter_notebook)$ pip install numpy

Upvotes: 1

Akshay
Akshay

Reputation: 783

If the kernel was not visible in the kernel options you will have to configure it manually. This is how I did it on my macos.

python3 -m pip install ipykernel
python3 -m ipykernel install --user

After running these commands you should be able to see the kernel in the change kernel option.

enter image description here

Upvotes: 1

Related Questions