Python

CentOS 7 Python3 설치

은둔한량 2024. 5. 31. 15:48
반응형

CentOS 7 기준

python 3.10 이상 부터 openssl version 1.1.1 이상을 요구한다.

1. Repository 변경

yum install epel-release -y

 

2. OpenSSL 1.1.1 버전 및 의존성 설치

yum install openssl11 openssl11-devel -y 
yum -y install yum-utils
yum -y install mariadb-devel
yum -y install zlib zlib-devel libffi-devel bzip2-devel
yum -y install gcc gcc-c++ openssl openssl-devel 
yum -y install zip unzip wget mc git net-tools

 

3. OpenSSL 버전 확인

[root@CALL-Statistics maxai]# openssl11 version
OpenSSL 1.1.1k  FIPS 25 Mar 2021

 

4. OpenSSL 전역변수 설정

export CFLAGS=$(pkg-config --cflags openssl11)
export LDFLAGS=$(pkg-config --libs openssl11)

 

5. Python 설치

wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz  --no-check-certificate

tar -zxvf Python-3.12.3.tgz

cd Python-3.12.3

./configure
make
sudo make install


6. Python 환경변수 설정 (alias)

vi /etc/profile

alias python3='/usr/local/bin/python3.12'
alias python='/usr/local/bin/python3.12'
alias pip='/usr/local/bin/pip3.12'

source /etc/profile
반응형