Python3.7.1从源代码编译安装

#!/bin/bash
#确保shell 切换到当前shell 脚本文件夹
current_file_path= ( c d " (cd " (cd"(dirname “$0”)"; pwd)
cd ${current_file_path}

#使用代理速度会快一点, 如果你有相应的代理
#export http_proxy=http://10.20.1.1:8118
#export https_proxy=https://10.20.1.1:8118

version=3.7.1
wget https://www.python.org/ftp/python/ v e r s i o n / P y t h o n − {version}/Python- version/Python{version}.tar.xz

yum install -y gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
mkdir /usr/local/python3

tar Jxvf Python- v e r s i o n . t a r . x z c d P y t h o n − {version}.tar.xz cd Python- version.tar.xzcdPython{version}
./configure --prefix=/usr/local/python3

make && make install
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py

echo “test python3 python”
python3
pip3
python

你可能感兴趣的:(常见IT基础,常用工具,python)