Python Forum
Changing Python Versions in Ubuntu 16.04
Thread Rating:
  • 4 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing Python Versions in Ubuntu 16.04
#1
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
Reply
#2
This is a snap if you use pyenv.
See this tutorial: https://python-forum.io/Thread-Part-1-Li...3#pid18603

and for Anaconda installation see: https://python-forum.io/Thread-Anaconda-...ight=pyenv
Reply
#3
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.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Crontab and python versions stsxbel 3 977 Jun-09-2025, 09:38 AM
Last Post: snippsat
  Python Launcher (on Windows) only necessary when 2 or more Python versions installed? pstein 1 3,765 Feb-17-2024, 12:43 PM
Last Post: deanhystad
  Virtual Env changing mysql connection string in python Fredesetes 0 1,462 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
Question log.exception() without arguments in old Python versions? cthart 5 3,164 Nov-19-2022, 07:09 PM
Last Post: Gribouillis
  Python in Singularity Container on Ubuntu erdemath 0 1,846 Aug-31-2022, 02:17 PM
Last Post: erdemath
  Python icons in Ubuntu KatManDEW 4 123,747 Aug-12-2022, 08:33 AM
Last Post: rob101
  Python 3.8 on Ubuntu 20.04 erdemath 1 2,668 Mar-07-2022, 09:31 PM
Last Post: Larz60+
  Python versions with libexpat fixes raghupcr 5 8,137 Feb-24-2022, 06:26 PM
Last Post: raghupcr
  Installed versions of Python SamHobbs 5 5,720 Sep-02-2021, 02:28 PM
Last Post: jefsummers
  changing Python files to .exe alok 2 3,437 Jul-20-2021, 02:49 PM
Last Post: alok

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020