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
  Python Launcher (on Windows) only necessary when 2 or more Python versions installed? pstein 1 265 Feb-17-2024, 12:43 PM
Last Post: deanhystad
  Virtual Env changing mysql connection string in python Fredesetes 0 325 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
Question log.exception() without arguments in old Python versions? cthart 5 1,135 Nov-19-2022, 07:09 PM
Last Post: Gribouillis
  Python in Singularity Container on Ubuntu erdemath 0 876 Aug-31-2022, 02:17 PM
Last Post: erdemath
  Python icons in Ubuntu KatManDEW 4 63,974 Aug-12-2022, 08:33 AM
Last Post: rob101
  Changing a string value to a numerical value using python code and a lamda function Led_Zeppelin 6 1,539 Jul-05-2022, 11:29 PM
Last Post: deanhystad
  Python 3.8 on Ubuntu 20.04 erdemath 1 1,333 Mar-07-2022, 09:31 PM
Last Post: Larz60+
  Python versions with libexpat fixes raghupcr 5 2,363 Feb-24-2022, 06:26 PM
Last Post: raghupcr
  Installed versions of Python SamHobbs 5 2,464 Sep-02-2021, 02:28 PM
Last Post: jefsummers
  changing Python files to .exe alok 2 2,185 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