Dreamhost上编译python并安装django

Python 2.5安装步骤:

wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz
tar -zxvf Python-2.5.2.tgz
cd Python-2.5.2
./configure --prefix=$HOME/lib --enable-unicode=ucs4
make
make install

python 2.5已经安装好了。把python 2.5设置为默认版本:

mkdir $HOME/bin
mkdir $HOME/bin/python
mkdir $HOME/bin/python/bin
ln -s $HOME/lib/bin/python $HOME/bin/python/bin/python

然后,在$HOME.bash_profile里加入一条:

export PATH=$HOME/bin/python/bin:$HOME/lib/bin:$PATH

重新载入配置文件:

source ~/.bash_profile

检验一下是否成功,输入python,显示:

Python 2.5.2 (r252:60911, Apr 4 2008, 22:51:28)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

mysql-python安装

wget http://nchc.dl.sourceforge.net/s ... python-1.2.2.tar.gz
tar -zxvf MySQL-python-1.2.2.tar.gz
cd MySQL-python-1.2.2
python setup.py build
python setup.py install

安装django

sudo wget -c http://media.djangoproject.com/releases/0.96/Django-0.96.tar.gz
tar xzvf Django-0.96.tar.gz
cd Django-0.96
sudo python setup.py install

测试一下django是否安装成功

cd ~
django-admin.py startproject djangosite
cd djangosite
sudo chmod +x manage.py
python manage.py runserver

显示

Validating models...
0 errors found.

Starting server on port 8000 with settings module 'newtest.settings'.
Go to http://127.0.0.1:8000/ for Django.
Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows).

安装flup

sudo wget -c http://www.saddi.com/software/flup/dist/flup-0.5.tar.gz
tar xzvf flup-0.5.tar.gz
cd flup-0.5
sudo python setup.py install