How to Change Default Python3 Version on Linux | Change default Python3 Version on Ubuntu

preview_player
Показать описание
How to Change Default Python Version on Linux | Change default Python3 Version on Ubuntu

If you want to change the version of Python that is associated with the python3 command to be Python 3.11.3, you can try the following steps:

1. Check if Python 3.11.3 is already installed on your system. Run the command python3.11 --version to verify if it returns the correct version. If it does, you can proceed to the next step. Otherwise, you need to install Python 3.11.3 first.

2. Determine the location of the Python 3.11.3 executable. Run the command which python3.11 to get the path to the Python 3.11.3 binary. It will return the full path if it is installed correctly.

3. Create a symbolic link for python3 that points to the Python 3.11.3 executable. Run the following command, replacing /path/to/python3.11 with the actual path obtained in the previous step:

shell
Copy code
sudo ln -sf /path/to/python3.11 /usr/bin/python3
This command creates a symbolic link at /usr/bin/python3 that redirects to the Python 3.11.3 executable.

Now, running python3 --version should display the version as 3.11.3. Verify this by executing the command: python3 --version.

By creating the symbolic link, you are essentially overriding the default Python 3 version with Python 3.11.3 when using the python3 command. However, keep in mind that modifying system-level configurations may require administrative privileges (sudo), and it's important to exercise caution.
Рекомендации по теме
Комментарии
Автор

ok wow that was quick and it worked!!! tysm!!!

emerald_grenade
Автор

So close! Thank you for your help! Buy next time could you leave all the commands up instead of clearing them so we don't have to keep going back and forth? Sorry to be critical, but thank you for your help!

iolsen
Автор

careful this can screw up your python3 execution

JoseGomesBicalho