OS/Rocky Linux

Rocky Linux 9 (9.5) Python 3.12 Install

강서버 2025. 4. 2. 11:46
728x90
반응형

Current Python version

$ python --version

or

$ python -V

 

[ Execution Log ]

[gangserver@localhost ~]$ python --version
Python 3.9.21

 

 

Install Python 3.12

$ sudo dnf install python3.12

or

$ sudo yum install python3.12

 

[ Execution Log ]

[gangserver@localhost ~]$ sudo dnf install python3.12
[sudo] gangserver의 암호: 
마지막 메타자료 만료확인(4:44:26 이전): 2025년 04월 02일 (수) 오전 06시 43분 21초.
종속성이 해결되었습니다.
================================================================================
 꾸러미                   구조       버전                   저장소         크기
================================================================================
설치 중:
 python3.12               x86_64     3.12.5-2.el9_5.2       appstream      26 k
종속 꾸러미 설치 중:
 libnsl2                  x86_64     2.0.0-1.el9.0.1        appstream      30 k
 mpdecimal                x86_64     2.5.1-3.el9            appstream      85 k
 python3.12-libs          x86_64     3.12.5-2.el9_5.2       appstream     9.2 M
 python3.12-pip-wheel     noarch     23.2.1-4.el9           appstream     1.5 M

연결 요약
================================================================================
설치  5 꾸러미

전체 내려받기 크기: 11 M
설치된 크기 : 44 M
진행할까요? [y/N]: y
(... Log omitted ...)

 

 

Move to /usr/bin directory and check Python executable file

$ cd /usr/bin

$ ls -al python*

 

[ Execution Log ]

[gangserver@localhost ~]$ cd /usr/bin
[gangserver@localhost bin]$ ls -al python*
lrwxrwxrwx. 1 root root     9 12월 13 02:18 python -> ./python3
lrwxrwxrwx. 1 root root     9 12월 13 02:18 python3 -> python3.9
-rwxr-xr-x. 1 root root 15632 12월 13 02:54 python3.12
-rwxr-xr-x. 1 root root 15632 12월 13 02:18 python3.9

 

 

python is linked to python3 and python3 is linked to python3.9 via symbolic links.

Change python3 symbolic link from python3.9 to python3.12

$ sudo ln -Tfs python3.12 python3

$ ls -al python*

 

[ Execution Log ]

[gangserver@localhost bin]$ sudo ln -Tfs python3.12 python3
[sudo] gangserver의 암호: 
[gangserver@localhost bin]$ ls -al python*
lrwxrwxrwx. 1 root root     9 12월 13 02:18 python -> ./python3
lrwxrwxrwx. 1 root root    10  4월  2 11:40 python3 -> python3.12
-rwxr-xr-x. 1 root root 15632 12월 13 02:54 python3.12
-rwxr-xr-x. 1 root root 15632 12월 13 02:18 python3.9

 

 

Check Python version and Run Python

$ cd

$ python --version

$ python

 

[ Execution Log ]

[gangserver@localhost bin]$ cd
[gangserver@localhost ~]$ python --version
Python 3.12.5
[gangserver@localhost ~]$ python
Python 3.12.5 (main, Dec  3 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[gangserver@localhost ~]$ 

 

728x90
반응형