Python Forum
Changing Python Versions in Ubuntu 16.04 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: General Coding Help (https://python-forum.io/Forum-General-Coding-Help)
+--- Thread: Changing Python Versions in Ubuntu 16.04 (/Thread-Changing-Python-Versions-in-Ubuntu-16-04)



Changing Python Versions in Ubuntu 16.04 - ErnestTBass - Jan-10-2019

I have three versions of Python on my laptop. They are Python 2.75, Python 3.5.2, and Python 3.6.2.

When I invoke the command

Python -V

I get the Python 2.75 version. That was fine in the past. Now I want to invoke Python -V and get the latest version Python 3.6.2.

Also, when I run jupyter notebook,it uses Python 2.75. I want it to use Python 3.6.2 instead.How do I change that?

I believe that these are really the same question.By changing Python -V to Python 3.6.2, I will have changed the default
Python interpreter to Python 3.6.2 in jupyter notebook.

Any help appreciated. Thanks in advance.

R,


ErnestTBass


RE: Changing Python Versions in Ubuntu 16.04 - Larz60+ - Jan-10-2019

This is a snap if you use pyenv.
See this tutorial: https://python-forum.io/Thread-Part-1-Linux-Python-3-environment?pid=18603#pid18603

and for Anaconda installation see: https://python-forum.io/Thread-Anaconda-and-other-ways-to-run-Python?highlight=pyenv


RE: Changing Python Versions in Ubuntu 16.04 - metulburr - Jan-10-2019

you can make an alias.
metulburr@ubuntu:~$ python -V
Python 2.7.12
metulburr@ubuntu:~$ echo "alias python='python3'" >> .bashrc
metulburr@ubuntu:~$ bash
metulburr@ubuntu:~$ python -V
Python 3.7.2
You can change python3 to whatever version you want to invoke. bash to reset the terminal. Or just open a new terminal.

This may or may not change jupyter notebook. If not, then you will have to go into its settings and change python to python3.6 for it to invoke that version. All IDE's have a method to change which python version it invokes.