做个笔记


1、安装依赖包

# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make


2、下载、编译、安装

# tar -xzvf /usr/local/src/Python-3.5.2.tgz 

# cd /usr/local/src/Python-3.5.2

# ./configure --prefix=/usr/local/python

# make -j 4

# make install


3、添加python到环境变量

# vim ~/.bash_profile


添加环境变量为,

PATH=$PATH:$HOME/bin:/usr/local/python/bin


4、使环境变量生效

# source ~/.bash_profile


5、解决pyhton升级后,Yum不能正常工作的问题

# vi /usr/bin/yum


将文件头部的

#!/usr/bin/pyhton

改为

#!/usr/bin/pyhton2.X