I tried to install a certain python module that required python 3.6 minimum to work properly so I checked my version using python --version
which gave me the output of Python 2.7.17
and then used python3 --version
giving me Python 3.6.9
. Now, I know for a fact that i have Python 3.8 installed because I ran apt install python3.8
just before checking the version.
If someone wants to know what my system is running; I am currently running Elementary OS 5.1.7 Hera.
EDIT:
(IDK what term to use, I want to say I am done going through answers, and I liked none.)
After a while of whacking my brain, I decided not to uninstall the 3.6 version as It may have version specific modules which if removed may cause other installed programs to break.
Since I just use Linux for my college-work, It wont matter if more than one versions are installed anyway.
Sorry for any mistakes I may have made, I was never good at this kind of things.
This question is more appropriate for Unix & Linux.
Python installations (more generally, versioned installations of software) co-exist on linux using version numbers. You can likely run Python 3.8
using the python3.8
command (or else, locate where you installed it and run from there / add the location to the PATH
environment variable to run directly).
Likewise, for each python version you can install its own package manager (e.g. install pip3.8
by python3.8 -m pip install pip
) and use it to install packages for that python version. (As different projects require different sets of packages, the general practice is to create a "virtual environment", i.e. a separate copy of the needed version of python, pip and their package installation folders for each project, and install the required packages there - for more information see e.g. this excellent answer).
Regarding the command python3
(usually /usr/bin/python3
) is just a symbolic link, you can replace it with the version you like (as long as it remains compatible with what the system expects - i.e. python3 of version no less than your built-in python3/python3-minimal, otherwise you will probably break something), e.g. assuming which python3
gives you /usr/bin/python3
, you can
sudo rm /usr/bin/python3 #remove existing link
sudo ln /usr/bin/python3.8 /usr/bin/python3 # create a new link to the version of your choice
(although a better alternative could be instead aliasing it alias python3='/usr/bin/python3.8'
and adding this to ~/.bashrc).
Whatever you do, do not uninstall python3-minimal
as it is - at least, on Ubuntu - required by the system and uninstalling or changing it will likely break the system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With