I have a little problem with changing python3 to default in newly installed operating system linux Mint 19.3. It was pretty easy on Ubuntu 16.04 but now I need small help here.
So, I run
python --version
and got this
Python 2.7.15+
Than I run
python3 --version
and this was the result
Python 3.6.8
After entering this command
sudo update-alternatives --config python
I received obvious info
update-alternatives: error: no alternatives for python
Both version of python are located in /usr/bin folder. The issue occurs when I'm trying to change python3 to as a default by typing the command
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6
The terminal outputs the following
update-alternatives: --install needs <link> <name> <path> <priority>
Any help here would be welcome.
To define python3 as your default version of python on linux, you need to add a specific line to .bashrc file located in your home directory. Here is a simple method to do so through command line interface (termianl). then run python --version to check if the change has applied.
Python 3.9 is the newest release of Python. It is available from the deadsnakes repository and source code. This post explains the Python 3.9 installation on Linux Mint 20.
Which leaves us with no choice other than, explicitly typing python3. However, we can set python3 as default by firing two commands on terminal Now if we check in the terminal by just running the “python” command it would result in the following: The interpreter of python 3 was launched, rather than an interpreter of python2.
If you have followed my article on how to install Python 3.9 on Ubuntu, you will notice that 3.9 is not the version used when running the following command: To update Python to the latest version installed on your system, we can use update-alternatives to change the python shortcut command to point to Python 3.9.
In your case, priority is missing, just append 1
at the end of the command like this :
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
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