centos 7编译安装Python3.6.1

时间:2021-06-19 06:51:32

1.准备必要的库文件

yum install -y gcc zlib-devel openssl-devel sqlite-devel

2.进入源代码包

./configure prefix=/usr/local/python3

3.编译安装

make -j2 && make install

4.添加bin目录到环境变量

vim /etc/profile

export PATH="$PATH:/usr/local/python3/bin"

echo 'export PATH="$PATH:/usr/local/python3/bin"' >> /etc/profile

5.升级pip

pip3 install --upgrade pip

6.安装virtualenv

pip3 install virtualenv

cd /usr/local/python3

ln -s virtualenv virtualenv3