簡介:
記錄一下關于 Python 環境軟件包的一些安裝步驟
1、升級 Python 到 2.7.10( 默認 2.6.6 )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
shell > yum - y install epel - release shell > yum - y install gcc wget readline - devel zlib - devel openssl - devel shell > wget https: / / www.python.org / ftp / python / 2.7 . 10 / Python - 2.7 . 10.tgz shell > tar zxf Python - 2.7 . 10.tgz shell > cd Python - 2.7 . 10 ; . / configure - - prefix = / usr / local / python2. 7 ; make ; make install shell > mv / usr / bin / python / usr / bin / old_python shell > ln - s / usr / local / python2. 7 / bin / python / usr / bin / python shell > sed - i '1s/python/old_python/' / usr / bin / yum shell > python - V Python 2.7 . 10 |
## 這樣就實現的 python 的升級
## readline-devel 這個包要事先安裝,不然后面的 ipython 不支持 tab 、方向鍵等,還要重新編譯 python
## zlib-devel 這個包 Setuptools 會用到,openssl-devel 這個包 pip 會用到
## /usr/bin/yum 文件解釋器要改一下,不然無法使用 yum
2、安裝 Setuptools
1
2
3
4
5
|
shell > wget https: / / pypi.python.org / packages / source / s / setuptools / setuptools - 15.2 .tar.gz #md5=a9028a9794fc7ae02320d32e2d7e12ee shell > tar zxf setuptools - 15.2 .tar.gz shell > cd setuptools - 15.2 ; python setup.py install shell > ln - s / usr / local / python2. 7 / bin / easy_install / usr / bin / easy_install |
## 這樣 Setuptools 也安裝好了,如果不安裝這個包直接下載 pip 源碼包安裝可能會報錯說找不到 Setuptools
3、安裝 pip
1
2
3
4
5
|
shell > wget https: / / pypi.python.org / packages / source / p / pip / pip - 6.1 . 1.tar .gz #md5=6b19e0a934d982a5a4b798e957cb6d45 shell > tar zxf pip - 6.1 . 1.tar .gz shell > cd pip - 6.1 . 1 ; python setup.py install shell > ln - s / usr / local / python2. 7 / bin / pip / usr / bin / pip |
## 這樣 pip 也安裝好了,當然,有了 easy_install 就可以直接 easy_install pip 了,源碼只是另外一種安裝方式
4、安裝 ipython
1
2
3
4
5
|
shell > wget https: / / pypi.python.org / packages / source / i / ipython / ipython - 3.1 . 0.tar .gz #md5=a749d90c16068687b0ec45a27e72ef8f shell > tar zxf ipython - 3.1 . 0.tar .gz shell > cd ipython - 3.1 . 0 ; python setup.py install shell > ln - s / usr / local / python2. 7 / bin / ipython / usr / bin / ipython |
## 這樣 ipython 也安裝好了,同樣可以通過 pip install ipython 來快速安裝