728x90

Python 3.10은 Ubuntu의 기본 저장소에서 사용할 수 없습니다. 따라서 Python 3.10 설치를 위해 다른 저장소를 추가해야 합니다. deadsnake라는 이름의 launchpad 저장소에서는 Python 패키지에 사용할 수 있습니다.

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
우분투에 파이썬 설치  (0) 2024.01.02
svn 재시작  (0) 2023.01.17
톰켓 로그 분할 하는 방법  (0) 2022.08.25

+ Recent posts