S
S
Sergey Karbivnichy2015-12-11 16:54:10
linux
Sergey Karbivnichy, 2015-12-11 16:54:10

How to make python3 be called by python command in linux?

Python 3 is installed on the system and it is called by the "python3" command. How can I make it be called by the "python" command?
I know it's very easy to do, but it flew out of my head. Googled but didn't find anything.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
R
Rikcon, 2015-12-11
@hottabxp

ln -s /path/to/python3 /usr/bin/python

O
Oleg Tsilyurik, 2015-12-11
@Olej

I know it's very easy to do, but it flew out of my head.

This is not easy to do, but very simple ... - but after that, get ready to reinstall the system in a new way.

X
XakRu, 2015-12-12
@XakRU

eselect python list  | grep python3 | awk '{print $1}'| cut -d [ -f 2 | cut -d ] -f 1 | xargs eselect python set

S
SquareWheel, 2015-12-12
@SquareWheel

alias python3='python'

T
Thrusted, 2021-10-21
@Thrusted

1. Option for the current session for the current user: 2. Option (1) plus adding .bashrc to the configuration (so as not to enter every time after login). You need to relogin at the end:
alias python='python3'

cd ~
echo alias python=\'python3\' >> .bashrc
logout

3. Option to make a python command for all users of the machine (you need rights, or ask the admin):
sudo ln -s /usr/bin/python3 /usr/bin/python

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question