centos7安装python3.6.6
1、安装依赖环境
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
1
2、下载
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
1
3、解压
tar -zxvf Python-3.6.6.tgz
cd Python-3.6.6
1
2
4、配置
./configure --prefix=/usr/bin/python3.6.6
1
报错:configure: error: no acceptable C compiler found in $PATH
原因是本机缺少gcc编译环境,安装即可:
yum install -y gcc
1
5、安装
make && make install
1
6、配置软连接,测试
ln -s /usr/bin/python3.6.6/bin/python3 /usr/bin/python3
python3 -V
1
2
7、 配置pip
cp /usr/bin/python3.6.6/bin/pip3 /usr/bin/
cp /usr/bin/python3.6.6/bin/pip3.6 /usr/bin/