ubuntu10.04解决GAE的python2.5依赖

| No Comments | No TrackBacks

GAE需要python2.5支持,而ubuntu从10.04开始就只支持python version >= 2.6了, 所以只能自个去编译python2.5了

----------

ubuntu10.04已经默认安装了python2.6

sudo apt-get install libssl-dev libsqlite3-dev sqlite3

 Python 自带的sqlite3模块只是sqlite的一个接口,包含实现部分, 需要先安装sqlite3再编译python,否则会找不到模块

下载python2.5源码, 解压缩

vim /Path/to/Python-2.5/Modules/Setup.dist

将如下行修改为(去掉开头的#号):

204:# Socket module helper for SSL support; you must comment out the other
205:# socket line above, and possibly edit the SSL variable:
206:SSL=/usr/local/ssl
207:ssl ssl.c
208: -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl
209: -L$(SSL)/lib -lssl -lcrypto

保存退出 => ./configure => make  => make altinstall

 

去http://pypi.python.org/pypi/ssl/1.15下载ssl-version.tar.gz并安装

去http://www.pythonware.com/products/pil/下载Imageing-version.tar.gz并安装

以上两条命令都是python2.5 setup.py install

 

安装easy_install:

wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg

sh setuptools-0.6c11-py2.5.egg

安装gae所需的django

easy_install-2.5 django==1.1.1

 

==========================

到此就安装完毕了

执行python2.5 /usr/local/lib/python2.5/test/test_socket_ssl.py 进行socket ssl测试

正常的话会打印出:

test_rude_shutdown ...
test_basic ...
test_timeout ...

执行python2.5并import sqlite3 ,无错则sqlite3正常

---------------------------------------

ubuntu 10.10应该也可以如此安装,但是10.04是LTS, 没有去测试10.10

 

参考文章:

GAE Python SDK on ubuntu 10.10 - SSL, Sqlite problems

relat - python25

Run GAE SDK for Python and Django on Ubuntu Maverick

Python SQLite 编程

ubuntu下安装python2.5.4支持ssl

No TrackBacks

TrackBack URL: http://blog.suchasplus.com/mt/mt-tb.cgi/287

Leave a comment