linux中安装python3.7
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 libffi-devel gcc
2. 下载python3.7
# 下载
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
#解压
tar -xvf Python-3.7.2.tgz
3. 执行配置文件,编译安装
mkdir -p /usr/local/python3.7
cd Python-3.7.2/
./configure --prefix=/usr/local/python3.7
make
make install
4. 建立软连接
#建立python3连接
ln -s /usr/local/python3.7/bin/python3.7 /usr/bin/python3
#建立pip3连接
ln -s /usr/local/python3.7/bin/pip3.7 /usr/bin/pip3
注意:
linux中自带的是python2,因为便于区分,便更名为python3、pip3
5. 测试
python3
pip3 -V