Hello can someone help me with this. So the issue is that I started using linux and I need to make my "python3" line code into just "python". For example -- "python3 run.py" (this is now), but i want just "python run.py". If someone can help me it would made my day
CodePudding user response:
All these answers assume your system doesn't have Python 2 installed, otherwise you might cause other issues.
The recommended way if you are using BASH on Linux or UNIX, is to edit the .bashrc file in your home directory :
~/.bashrc
The '~' 'points to your home directory '/home/username'. Once you have this file open, add the following to the bottom :
alias python='python3'
Now typing 'python' will automatically run Python 3. I use this method because it doesn't require altering system files, but you can't run as sudo (which might be a good thing).
If you need to use 'sudo', create a symbolic link with the following command:
sudo ln -s /usr/bin/python3 /usr/local/bin/python
Alternatively install the 'python-is-python3' package, as mentioned by @chepner the following assumes you are using the apt package manager, and similarly does nothing more than create a symbolic link :
sudo apt install python-is-python3
CodePudding user response:
1.Go to terminal type - python --version 2.Log in with root privileges sudo su 3.Execute this command update-alternatives --install /usr/bin/python python /usr/bin/python3 4. Check version again
CodePudding user response:
You can install python-is-python3 package:
$ sudo apt install python-is-python3
