1、安装好CentOS7.0 :
[root@localhost ~]# cat /proc/version
Linux version 3.10.0-229.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Fri Mar 6 11:36:42 UTC 2015
[root@localhost ~]#
2、确保liunx主机能上互联网:
[root@localhost ~]# nslookup
> www.python.org
Server: 192.168.8.254
Address: 192.168.8.254#53
Non-authoritative answer:
www.python.org canonical name = python.map.fastly.net.
python.map.fastly.net canonical name = prod.python.map.fastlylb.net.
Name: prod.python.map.fastlylb.net
Address: 151.101.36.223
>
3、下载python安装包:
[root@localhost ~]# wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0b4.tgz
--2016-06-21 15:32:23-- https://www.python.org/ftp/python/3.5.0/Python-3.5.0b4.tgz
正在解析主机 www.python.org (www.python.org)... 151.101.36.223
正在连接 www.python.org (www.python.org)|151.101.36.223|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:19980637 (19M) [application/octet-stream]
正在保存至: “Python-3.5.0b4.tgz”
100%[==============================================>] 19,980,637 34.6KB/s 用时 9m 59s
2016-06-21 15:42:24 (32.6 KB/s) - 已保存 “Python-3.5.0b4.tgz” [19980637/19980637])
[root@localhost ~]#
4、解压安装python:
[root@localhost ~]# ll
总用量 16320
-rw-r--r--. 1 root root 16664311 6月 21 15:40 Python-3.5.0b4.tgz
[root@localhost ~]# tar -zxvf Python-3.5.0b4.tgz
[root@localhost ~]# ll
总用量 19520
drwxrwxr-x. 16 1000 1000 4096 7月 26 2015 Python-3.5.0b4
-rw-r--r--. 1 root root 19980637 7月 26 2015 Python-3.5.0b4.tgz
[root@localhost ~]# cd Python-3.5.0b4/
[root@localhost Python-3.5.0b4]# ./configure
[root@localhost Python-3.5.0b4]# make
[root@localhost Python-3.5.0b4]# make install
看到以下信息,说明python安装完成:第二行会因liunx的版本不一样而异同,请留意!
[root@localhost Python-3.5.0b4]# python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>