centos6.8 安装python3.6

  1. 下载Python安装包
cd /usr/local/src

wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz 
  1. 解压
tar -zxvf Python-3.6.0.tgz 
  1. 进入解压目录
cd Python-3.6.0
  1. 编译安装包
./configure --prefix=/usr/local/python
make && make install
  1. 添加环境变量
echo PATH='/usr/local/python/bin/:$PATH' >> /etc/profile

source /etc/profile
  1. 检查是否成功,执行下面代码
python3.6

Python 3.6.0 (default, Jun  1 2017, 14:01:43) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('hello word')
hello word

你可能感兴趣的:(python)