Linux/Ubuntu
Ubuntu 18.04에서 python dual로 세팅하기
jinmc
2020. 10. 19. 11:17
반응형
unix.stackexchange.com/questions/410579/change-the-python3-default-version-in-ubuntu
Change the Python3 default version in Ubuntu
I am using Ubuntu 16.04 LTS . I have python3 installed. There are two versions installed, python 3.4.3 and python 3.6 . Whenever I use python3 command, it takes python 3.4.3 by default. I want to ...
unix.stackexchange.com
관련 포스팅.
1번 답변 (246 upvote):
From the comment:
sudo update-alternatives --config python
Will show you an error:
update-alternatives: error: no alternatives for python3
You need to update your update-alternatives , then you will be able to set your default python version.
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.4 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
Then run :
sudo update-alternatives --config python
Set python3.6 as default.
Or use the following command to set python3.6 as default:
sudo update-alternatives --set python /usr/bin/python3.6
2번 답변 : (37 upvote)
You can achieve this by applying below simple steps -
- Check python version on terminal - python --version
- Get root user privileges. On terminal type - sudo su
- Write down the root user password
- Execute this command to switch to python 3.6 -
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 - Check python version - python --version
- Done.
반응형