Update Python 3x

Asked

Viewed 189 times

-1

I have version 3.7.3 of Python (for studies only) in my Raspbian Buster and would like to update it to the latest version (3.8.3).

I’ve tried to use sudo apt update and sudo apt upgrade but the system did not update stating that the packages are up to date.

How to proceed in this case?

  • for the short time that I have been using exclusively linux, I noticed that python is only updated to recent versions when the distro developers choose to do, then apt update/upgrade will work, if you want python3.8 installed you would have to do this explicitly, treat as a second program, an independent program, and in advance do not delete python 3.7 because there may be system functions dependent on this version and the exclusion can break the system, already seen in such reports foruns, it was not rasp, but better not risk

1 answer

0

Python that comes in the system is used, among other things, to run the various applications that are installed and that have been made in Python. Of course you can use it to code in Python, but most distributions won’t have the newer version. Especially a Debian-based distribution (which excels in stability rather than being "at the top of the wave") like Raspbian.

Arch Linux, for example, has a "rolling release" model and is always up to date and at that moment I write the version of Python in Arch is 3.8.2 (this is the latest version so far and 3.8.3 is still as "release candidate").

But the best thing about Python is to use a virtual environment instead of using the Python that comes with the system. A virtual environment is isolated and separated from Python from the system and with this you can use different versions of Python and any library you wanted to use without risking harming some other application.

To work with virtual environments there are some options, including complete distributions (with their own repositories) such as anaconda (probably the easiest option). With anaconda you create a virtual environment and specify the exact version of Python you want to use.

Other options to use virtual environments are pipenv, Poetry, or even the module itself venv which already comes in python 3. But I believe that these options only manage the libraries and not the python version (you work with an isolated python, but the same version of the system). To work with different versions of python you have the pyenv, which is certainly used along with some of the options to work with virtual environments.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.