歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> [Python] 安裝及環境配置

[Python] 安裝及環境配置

日期:2017/2/28 14:43:39   编辑:Linux教程

1. 首先,通過wget下載Python安裝包
[root@TDDBA ~]# wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

2. 解壓該文件
[root@TDDBA python]# tar -zxvf Python-2.7.3.tgz
[root@TDDBA python]# ls
Python-2.7.3 Python-2.7.3.tgz

3. 配置安裝路徑
[root@TDDBA Python-2.7.3]# ./configure --prefix=/usr/local/python-2.7.3

4. 編譯和安裝
[root@TDDBA Python-2.7.3]# make
[root@TDDBA Python-2.7.3]# make install

5. 配置軟鏈接
[root@TDDBA /]# ln -s /usr/local/python-2.7.3/bin/python /bin/python-2.7.3
[root@TDDBA /]# python-2.7.3
Python 2.7.3 (default, Mar 16 2013, 19:12:21)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

6. 下載安裝setuptools
注意:下載時記得下載源文件。
[root@TDDBA python]# wget
https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
[root@TDDBA python]# tar -zxvf setuptools-0.6c11.tar.gz
[root@TDDBA python]# cd setuptools-0.6c11
[root@TDDBA setuptools-0.6c11]# python-2.7.3 setup.py build
[root@TDDBA setuptools-0.6c11]# python-2.7.3 setup.py install
[root@TDDBA bin]# ln -s /usr/local/python-2.7.3/bin/easy_install /bin/easy_install-2.7.3
7. 利用easy_install安裝相應庫
[root@TDDBA setuptools-0.6c11]# easy_install-2.7.3 django

參考: Python學習總結—安裝與配置環境 http://www.linuxidc.com/Linux/2012-11/73912.htm

Copyright © Linux教程網 All Rights Reserved