centos编译安装python3.7
1.安装依赖,下载python3.7
# 1、yum更新yum源
yum update
# 2、安装Python 3.7所需的依赖否则安装后没有pip3包
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make
# 3、在官网下载所需版本,这里用的是3.7.0版本
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
2.安装python
copy
# 1、解压
tar -zxvf Python-3.7.0.tgz
#2、配置编译
cd Python-3.7.0
./configure --prefix=/usr/local/python3 # 配置编译的的路径(这里--prefix是指定编译安装的文件夹)
./configure --enable-optimizations # 执行该代码后,会编译安装到 /usr/local/bin/ 下,且不用添加软连接或环境变量
make && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3 # 添加软连接
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
#3、将/usr/local/python3/bin加入PATH
[root@linux-node1 testProj]# vim /etc/profile
#然后在文件末尾添加
export PATH=$PATH:/usr/local/python3/bin
[root@localhost Python-3.7.0]# source /etc/profile # 修改完后,还需要让这个环境变量在配置信息中生效,执行命令
标签:bin,centos,local,devel,3.7,usr,安装,python3 From: https://www.cnblogs.com/Mr-Simple001/p/16650187.html