Home [Ubuntu]명령어 우선순위 변경
Post
Cancel

[Ubuntu]명령어 우선순위 변경

Ubuntu 명령어 우선순위 변경 (Python3)

1
2
3
python

-bash: /usr/bin/python: No such file or directory

Alternatives

  1. Python3 위치 파악
    1
    2
    3
    
     which python3
        
     /usr/bin/python3
    
  2. python의 alternatives 파악
    1
    2
    3
    
     sudo update-alternatives --config python
    
     update-alternatives: error: no alternatives for python
    
  3. 명령어 우선순위 등록
    1
    2
    3
    
     # update-alternatives --install [SYMBOLIC_PATH] [ALTER_NAME] [REAL_PATH] [NUMBER]
     sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
     sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2 # if python2 exists
    
  4. 명령어 확인
    1
    
     sudo update-alternatives --config python
    

Alternatives 제거

1
2
# sudo update-alternatives --remove [ALTER_NAME] [REAL_PATH]
sudo update-alternatives --remove python /usr/bin/python3
This post is licensed under CC BY 4.0 by the author.