-
step1:安装依赖环境
# 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
-
step2:下载python3.6
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
-
step3:安装Python3
解压python3.tgz
tar -xvf Python-3.6.4.tgz
创建python3的文件路径
mkdir /usr/local/python3
-
step4:编译(在解压的文件夹下)
./configure --prefix=/usr/local/python3
-
step5:安装(在解压的文件夹下 )
make make install<br>先make再make install
-
step6:创建新版本软连接
①修改旧版本
mv /usr/bin/python /usr/bin/python_bak
②创建新的软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python
③检查python的版本
python -V
-
step7:配置pip3
将/usr/local/python3/bin加入PATH
vim ~/.bash_profile
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin:/usr/local/python3/bin export PATH
保存退出后,执行以下命令,让上一步修改操作立即生效
source ~/.bash_profile
- step8:更新pip3 版本
查看当前pip3版本信息
pip3-V
更新pip3 版本
pip3 install --upgrade pip
查看pip3安装的库
pip3 freeze
完成