Setting up the Default Python program

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
SupplyChain315

Setting up the Default Python program

Post by SupplyChain315 »

I'm not too familiar with the file system or terminal commands. I downloaded the Python 3.6 software from their website only find it already installed with the Mint OS. Looks like the pre-installed version is 3.6. Is this software I need to "configure" in order to use it. There are a lot of files in different folders. I already searched the forum only to find a topic about "segmentation default". Can someone point me in the right direction?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Setting up the Default Python program

Post by xenopeek »

Welcome to the Linux Mint forums.

What exactly are you trying to do? Mind that a lot of software on your Linux Mint system depends on the default Python versions remaining unchanged (as the software was developed and tested with that version). You wouldn't be the first person to give themselves a headache of work trying to undo them changing their default Python versions.

Python can actually have many versions installed in parallel without problem. Just don't touch the default Python version!

Linux Mint by default comes with python2 version 2.7 and python3 version 3.6. You can just start those programs from the terminal to go to the Python interactive shell of that version. Or if you're writing a Python program just use the proper hashbang line, #!/usr/bin/python2 for Python 2 programs and #!/usr/bin/python3 for Python 3 programs. While python is also available and currently defaults to python2 it will at some point in the future (as it already does on certain other Linux distros) default to python3. So to be future proof write your scripts making explicit whether they are for Python 2 or Python 3.

If you need a newer Python version, you will find Python 3.7 is also available for installation. Just install python3.7-minimal package through Software Manager. It will not touch your default Python 3 version so not risk borking other Python 3 using programs on your system. You can then put the hashbang #!/usr/bin/python3.7 to make your Python program use Python 3.7.

You can see all installed Python versions and defaults with command ll /usr/bin/python*
Image
Locked

Return to “Software & Applications”