Python编译安装

Eave 2023.08.06 02:30

1、下载Python

下载地址:https://www.python.org/downloads

wget https://www.python.org/ftp/python/3.10.12/Python-3.10.12.tgz

2、安装Python

tar -zxf Python-3.10.12.tgz
cd Python-3.10.12
./configure --prefix=/usr/local/python --enable-optimizations
make -j4 && make install

3、编辑/etc/profile文件

/etc/profile文件末尾追加以下内容

# Python
export PATH=$PATH:/usr/local/python/bin

4、执行一下命令使配置生效

source /etc/profile