[python] 우분투에서 파이썬 버전 변경

Mineru·2022년 5월 25일
0
# 파이썬 버전 확인
python -V

# 파이썬 실행 코드 위치
which python
# /usr/bin/python

# 링크 정보 확인
ls -al /usr/bin/python
# lrwxrwxrwx 1 root root 24  5월 26 03:16 /usr/bin/python -> /usr/bin/python2.7

# python이란 이름을 가진 실행 코드 확인
ls /usr/bin/ | grep python

버전 변경 방법

sudo update-alternatives --config python
# update-alternatives: error: no alternatives for python

아무런 설정을 하지 않으면 위와 같은 에러가 발생한다.

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2

위 코드와 같이 입력을 하면 버전이 변경 된다.

profile
Daily Coding

0개의 댓글