1. 從oracle官方網站下載virtualbox (我的是4.3.20 96996)
2. centos.org官網上下載centos (我下載的是centos 6.6 mini版 300多MB)
3. virtualbox安裝
4. centos 在virtualbox中安裝,注意:網卡請配置橋接模式
5. 啓動centos,並設置網卡, 具體如下:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
(默認onboot = no,需設置爲 onboot= yes),wq!保存退出,並重啓服務器
6. 升級centos,並安裝開發工具
1
2
|
yum -y update
yum groupinstall -y 'development tools'
|
7.安裝SSL、bz2、zlib包
1
|
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget
|
8. 安裝 Python 2.7.8
1
2
3
|
wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
xz -d Python-2.7.8.tar.xz
tar -xvf Python-2.7.8.tar
|
9.編譯
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# Enter the directory:
cd Python-2.7.8
# Run the configure:
./configure --prefix=/usr/local
# compile and install it:
make
make altinstall
# Checking Python version:
[root@nicetry ~]# python2.7 -V
Python 2.7.8
|
If you need set PATH
variable
check the line bellow:
1
|
export PATH="/usr/local/bin:$PATH"
|
10 安裝 pip 和 virtualenv
Python安裝是否結束了,我們是否遺漏了什麼,對!我們需要 pip and virtualenv.
Install setuptools
1
2
3
4
5
6
7
8
|
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
# Extract the files:
tar -xvf setuptools-1.4.2.tar.gz
cd setuptools-1.4.2
# Install setuptools using the Python 2.7.8:
python2.7 setup.py install
|
安裝 pip
1
|
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python2.7 -
|
最後安裝 virtualenv
1
|
pip2.7 install virtualenv
|
至此,我們python 2.7.8的安裝就算全部結束了