How do you override Python 3.9.2 (which is installed by default) with Python 3.9.4?

Hello. I’m currently wondering how I could override the default Python 3.9.2 that gets installed with EndeavourOS, with Python 3.9.4. I’ve tried installing Python 3.9.4 from the python.org website, but when I run python --version or python3 --version, it keeps on saying it’s version 3.9.2. I tried to uninstall python, but I’m pretty sure that would cause problems. Thanks.

Welcome to the forum!

It depends on why you want to do that.

If you want to do it for development purposes, you should use a pyenv or something similar which has it’s own version of python which remains isolated from the system version of Python.

Alternatively, if you want to install it system-wide, you can grab that assets for the python package from here. From there just modify the PKGBUILD to pull in the version you want and then build and install the package.

Lastly, you could just wait for it to hit the repos. In an Arch-based distro, it probably won’t take all that long.

The one thing you shouldn’t do is manually install it to a system-wide location like /usr or /bin. This will lead to breakages. In general, you need to use the package manager to install software. If you do it manually, be sure to install it to your home directory or some other isolated location.

1 Like

Well, I rebooted my system, and when I run python --verison, it’s still version 3.9.2, but if I run python3 --version, it’s verison 3.9.4. Is this fine, or will it break my system?

It depends what you did exactly, if you overwrote any components of any of the python package, you are going to have a bit of a mess on your hands.

How do I know I did that, and are there any signs if I did something wrong? Like errors?

What does which python3 return?

See if you get errors when you reinstall python.

sudo pacman -S python
  1. Download the PKGBUILD;
  2. Increment the pkgver;
  3. Build with makepkg;
  4. Install and hope nothing else needed a rebuild or will break against the new Python version.

I think that package has local assets that also need to be downloaded.

1 Like

python3 returns Python 3.9.4.

And nope, no errors when reinstalling Python.

That should be:

which python3

it returns /usr/local/bin/python3

That should be fine then. It installed into a location that shouldn’t conflict with any system files.

That being said, I would still recommend avoiding that approach in the future. It is always better to use the package manager to install packages.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.