[Python] 安装及环境配置

来源:互联网 发布:机构持仓数据查询 编辑:程序博客网 时间:2024/06/09 17:02
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
4. 编译和安装
[root@TDDBA Python-2.7.3]# make
[root@TDDBA Python-2.7.3]# make install
5. 配置软链接
[root@TDDBA /]# ln -s /usr/local/python/bin/python /bin/python
[root@TDDBA /]# python
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 setup.py build
[root@TDDBA setuptools-0.6c11]# python setup.py install
[root@TDDBA bin]# ln -s /usr/local/python/bin/easy_install /bin/easy_install
7. 利用easy_install安装相应库
[root@TDDBA setuptools-0.6c11]# easy_install django
原创粉丝点击