#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
#yum install gcc
下载链接点这里 https://www.python.org/downloads/
或者
#wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
我个人习惯安装在/usr/local/python3(具体安装位置看个人喜好)
创建目录:
#mkdir -p /usr/local/python3
解压下载好的Python-3.x.x.tgz包(具体包名因你下载的Python具体版本不不同⽽而不不同,如:我下载的是Python3.6.1.那我这里就是Python-3.6.1.tgz)
# tar -zxvf Python-3.6.1.tgz
#cd Python-3.6.1
# ./configure --prefix=/usr/local/python3
# make
#make install
make install 或者 make && make install
# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
添加pip 软连接
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
vim /etc/profile
并将/usr/local/python3/bin加入PATH
vim /etc/profile
export PATH=$PATH:/usr/local/python3/bin
按ESC,输入:wq回车退出。
修改完记得执行行下面的命令,让上一步的修改生效:
# source profile
# python3 -V
Python 3.6.1
# pip3 -V
pip 9.0.1 from /usr/local/python3/lib/python3.6/site-packages (python 3.6)
对pip 进行升级
python3.6 -m pip install --upgrade pip