[Python] 安装及环境配置

1. 首先,通过wget下载Python安装包
[root@TDDBA ~]# wget

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.heiqu.com/19283.html