标签:python
一、查看Linux系统版本信息
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# uname -r
3.10.0-123.el7.x86_64
[root@localhost ~]# uname -m
x86_64
二、下载python版本
[root@localhost application]# cd /home/qiu/tools/
[root@localhost tools]# wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
三、安装python依赖的包
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
【如果已经安装过就不需要再安装】
四、解压python、安装python
1、解压安装
tar zxf Python-3.6.2.tgz
2、将解压后的文件移动
mv Python-3.6.2 /usr/local/python-3.6.2
cd /usr/local/python-3.6.2/
ls
3、删除之前的/usr/bin下的Python连接
ll /usr/bin | grep python
rm -rf /usr/bin/python
./configure --enable-optimizations
echo $?
make
make install
4、重新设置软连接到/usr/bin下面
ln -s /usr/local/bin/python3.6 /usr/bin/python
【由于Python默认安装路径是 /usr/local/bin/python3.6】
五、测试
[root@localhost local]# python --version
Python 3.6.2
[root@localhost local]# python
六、注意
安装python-3.6.2时,已经自动安装好了pip在/usr/local/bin目录,不需要单独安装pip。!
[root@localhost bin]# cd /usr/local/bin/
[root@localhost bin]# ls
本文出自 “doublelinux” 博客,谢绝转载!
标签:python
原文地址:http://doublelinux.blog.51cto.com/12300166/1956259