2020년 2월 8일 토요일

ubuntu python 설정

python 3.6을 기본으로 사용하기

$ cat /etc/issue.net
Ubuntu 18.04.3 LTS

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

$ ls -lart /usr/bin/python*
-rwxr-xr-x 1 root root    1342 May  2  2016 /usr/bin/python3-jsonpointer
-rwxr-xr-x 1 root root    3661 Oct 29  2017 /usr/bin/python3-jsonpatch
-rwxr-xr-x 1 root root    1018 Oct 29  2017 /usr/bin/python3-jsondiff
-rwxr-xr-x 1 root root     398 Nov 16  2017 /usr/bin/python3-jsonschema
lrwxrwxrwx 1 root root       9 Apr 16  2018 /usr/bin/python2 -> python2.7
lrwxrwxrwx 1 root root      17 Oct 25  2018 /usr/bin/python3m-config -> python3.6m-config
lrwxrwxrwx 1 root root      10 Oct 25  2018 /usr/bin/python3m -> python3.6m
lrwxrwxrwx 1 root root      16 Oct 25  2018 /usr/bin/python3-config -> python3.6-config
lrwxrwxrwx 1 root root       9 Oct 25  2018 /usr/bin/python3 -> python3.6
lrwxrwxrwx 1 root root      34 Oct  7 21:59 /usr/bin/python3.6m-config -> x86_64-linux-gnu-python3.6m-config
-rwxr-xr-x 2 root root 4526456 Oct  7 21:59 /usr/bin/python3.6m
lrwxrwxrwx 1 root root      33 Oct  7 21:59 /usr/bin/python3.6-config -> x86_64-linux-gnu-python3.6-config
-rwxr-xr-x 2 root root 4526456 Oct  7 21:59 /usr/bin/python3.6
-rwxr-xr-x 1 root root 3641704 Oct  8 02:39 /usr/bin/python2.7
lrwxrwxrwx 1 root root      24 Jan 31 00:08 /usr/bin/python -> /etc/alternatives/python

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python (python) in auto mode

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2
update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode

$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python2.7   2         auto mode
  1            /usr/bin/python2.7   2         manual mode
  2            /usr/bin/python3.6   1         manual mode

Press to keep the current choice[*], or type selection number: 2

$ python -V
Python 3.6.8


댓글 없음: