安装python2.7.3

1. 查看当前python的版本:
   #python  即可查看
   #which python 查看python的安装路径

2.安装python 2.7.3(转)

1. install python 2.7

refer: http://www.cnblogs.com/minglog/archive/2011/04/20/2022479.html

wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2

./configure

make

make install

rm /usr/bin/python

ln -s /usr/local/bin/python2.7 /usr/bin/python

*******************

发现yum不能用了,yum依赖python2.4, 处理如下:

vim /usr/bin/yum

将文件头部的

#!/usr/bin/python

改成

#!/usr/bin/python2.4

就可以继续使用yum了

*******************

2. install setuptools

wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea

sh setuptools-0.6c11-py2.7.egg

3. install python modules

.feedparser

#easy_install feedparser 编码处理有些问题

下载feedparser-5.0.1源码

feedparser.py 3524行

elif http_content_type.startswith('text/'):

        #true_encoding = http_encoding or 'us-ascii'

        true_encoding = http_encoding or xml_encoding or 'utf-8'

  python setup.py build

        python setup.py install

        .BeautifulSoup

easy_install BeautifulSoup

        .chardet

easy_install chardet

.PIL

yum install libjpeg-devel zlib-devel freetype-devel

#easy_install PIL #has problems, not support jpeg, etc

wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz

python setup.py build_ext -i

python setup.py install

.MySQLdb

yum install mysql-devel

http://ncu.dl.sourceforge.net/project/mysql-python/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz

python setup.py build

python setup.py install

4. Tips

easy_install安装后如何删除

编辑 /usr/local/lib/python2.7/site-packages/easy-install.pth , 删除相应的行。删除相应的egg文件。

python -u

-u     : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x 
         see man page for details on internal buffering relating to '-u'


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值