How To Change Default Python On A Linux Machine

how-to-change-default-python-on-a-linux-machine

Let’s say you have installed Python into the following folder

/home/ubuntu/Python-3.10.13

To set it default python version open a terminal

Execute the following commands

echo 'export PATH="https://dev.to/home/ubuntu/Python-3.10.13:$PATH"' >> ~/.bashrc

source ~/.bashrc

Then with the following command you should see 3.10.13 as default

python --version

This above will make it only temporarily for that terminal session

Execute below ones for permanent on all terminals

echo 'export PATH=/home/ubuntu/Python-3.10.13:$PATH' >> ~/.bash_profile
echo 'export PATH=/home/ubuntu/Python-3.10.13:$PATH' >> ~/.profile
echo 'export PATH=/home/ubuntu/Python-3.10.13:$PATH' | sudo tee -a /etc/environment
echo 'export PATH=/home/ubuntu/Python-3.10.13:$PATH' | sudo tee -a /etc/profile.d/custom.sh

Image description

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
how-to-include-version,-git-commit,-and-build-date-in-your-angular-builds

How to Include Version, Git Commit, and Build Date in Your Angular Builds

Next Post
no-jobs-for-juniors-in-it?-

No jobs for juniors in IT? 💻👩‍💻

Related Posts