How to make Ubuntu 18.04 LTS use python 3.7 as default?

Sorin Srbu sorin.srbu at ki.se
Thu Jul 30 06:46:23 UTC 2020


On Thu, 2020-07-30 at 08:15 +0200, Bo Berglund wrote:
> It has python 2.7 installed as its default python and now I am getting
> problems because apparently 2.7 is no longer the version used for some
> of my tools, which prints messages that all upgrades must use python 3
> (actually 3.5 or higher).
> I have managed to install 3.7 even though the ubuntu apt system only
> provides a much lower version.
> I did that using this instruction page:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flinuxize.com%2Fpost%2Fhow-to-install-python-3-7-on-ubuntu-18-04%2F&data=02%7C01%7Csorin.srbu%40ki.se%7C35f91e03ea154f932f1308d834502ad6%7Cbff7eef1cf4b4f32be3da1dda043c05d%7C0%7C0%7C637316866215256407&sdata=MdIq4p8lPq5PwF6LTWoWommxHH7y%2F7nE4GvT%2BxhuTLA%3D&reserved=0
> 
> So now I have this:
> ~$ python --version
> Python 2.7.17
> ~$ python2 --version
> Python 2.7.17
> ~$ python3 --version
> Python 3.6.9
> ~$ python3.7 --version
> Python 3.7.8
> 
> As you can see I seem to have 3 installed versions but the default
> version is the oldest...
> 
> So how can I make python use version 3 (or even 3.7.8)?
> 

Hello Bo!

Maybe try "sudo update-alternatives --config python"?

See eg 
https://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux#h2-change-python-version-system-wide
 for a nice howto and guide.

Cheers!

-- 

Sorin Srbu, Serverdrift
Karolinska Institutet Universitetsbibliotek
Avdelningen för Verksamhetsstöd
Enheten för Teknikstöd och Bildproduktion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20200730/71645ee5/attachment.sig>


More information about the ubuntu-users mailing list