728x90

1. 저장소 추가하기

다음 명령을 사용하여 deadsnake 저장소를 추가합니다.

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update

패키지가 잘 업데이트 됐는지 아래 명령어로 확인해 줍니다.

apt list | grep python3.10

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

idle-python3.10/focal,focal 3.10.10-1+focal1 all
libpython3.10-dbg/focal 3.10.10-1+focal1 amd64
libpython3.10-dev/focal 3.10.10-1+focal1 amd64
libpython3.10-minimal/focal 3.10.10-1+focal1 amd64
libpython3.10-stdlib/focal 3.10.10-1+focal1 amd64
libpython3.10-testsuite/focal,focal 3.10.10-1+focal1 all
libpython3.10/focal 3.10.10-1+focal1 amd64
libqgispython3.10.4/focal 3.10.4+dfsg-1ubuntu2 amd64
python3.10-dbg/focal 3.10.10-1+focal1 amd64
python3.10-dev/focal 3.10.10-1+focal1 amd64
python3.10-distutils/focal,focal 3.10.10-1+focal1 all
python3.10-examples/focal,focal 3.10.10-1+focal1 all
python3.10-full/focal 3.10.10-1+focal1 amd64
python3.10-gdbm-dbg/focal 3.10.10-1+focal1 amd64
python3.10-gdbm/focal 3.10.10-1+focal1 amd64
python3.10-lib2to3/focal,focal 3.10.10-1+focal1 all
python3.10-minimal/focal 3.10.10-1+focal1 amd64
python3.10-tk-dbg/focal 3.10.10-1+focal1 amd64
python3.10-tk/focal 3.10.10-1+focal1 amd64
python3.10-venv/focal 3.10.10-1+focal1 amd64
python3.10/focal 3.10.10-1+focal1 amd64

2. Python 3.10 설치하기

sudo apt install python3.10

3. (Option) 다른 Python 버전과 함께 사용하기

만약 Python 3.10 설치 전 다른 Python3.x 버전을 사용하고 있었다면, update-alternatives를 이용해 관리해준다. 본인은 3.8 버전을 기존해 사용하고 있었다.

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

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

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

  Selection    Path                 Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3.10   2         auto mode
  1            /usr/bin/python3.10   2         manual mode
  2            /usr/bin/python3.8    1         manual mode

Press <enter> to keep the current choice[*], or type selection number: 0

$python3 -V
Python 3.10.10

출처: https://sonseungha.tistory.com/678 [Developer's Delight:티스토리]

728x90

'프로그래밍 > 리눅스' 카테고리의 다른 글

우분투 파이썬 설치  (0) 2024.02.25
유분투 크롬 설치  (0) 2024.02.25
svn 재시작  (0) 2023.01.17
톰켓 로그 분할 하는 방법  (0) 2022.08.25
리눅스 파일 있으면 복사 없으면 생성하기  (0) 2022.08.18

+ Recent posts