django安装步骤
1、安装django,
1.a下载django official version,站点https://www.djangoproject.com/download/
1.b解压,tar xzvf Django-1.3.1.tar.gz
1.c进入解压后的目录 cd Django-1.3.1
1.d安装 sudo python setup.py install
1.e测试是否安装成功,在linux终端输入python,进入python交互界面,之后输入命令‘import django’。如果import成功,则安装成功
2、安装数据库服务器(mysql)
2.a sudo apt-get install mysql-server mysql-client #中途会让你输入一次mysql root用户的密码
2.b一旦安装完成,MySQL 服务器应该自动启动。 手动启动的命令是:sudo start mysql,手动停止的命令是:sudo stop mysql。
3.c 进入mysql,mysql -u root -p
3.d 修改root用户密码:sudo mysqladmin -u root password newpassword
3.e 简单操作show databases;
3、安装MySql-Python
3.a 下载源码包,下载地址http://sourceforge.net/projects/mysql-python/
3.b 解压。。。。.tar xfz MySQL-python-1.2.1.tar.gz,,, cd MySQL-python-1.2.1,,,
3.c 安装setuptools,网址:http://pypi.python.org/pypi/setuptools#downloads
3.d You need MySQL-devel to compile, but its not called that, its called: libmysql++-dev on Ubuntu
sudo apt-get install libmysql++-dev
3.e 修改site.cfg, 第一registry_key = SOFTWARE\MySQL AB\MySQL Server 5.5,这里5.5是你安装的mysql的版本,其次,threadsafe = True改成 False.最后是
mysql_config = /usr/bin/mysql_config
3.e 安装 sudo python setup.py build
sudo python setup.py install
If you get this error you need to install python-dev package:
1 In file included from _mysql.c:29:
2 pymemcompat.h:10:20: error: Python.h: No such file or directory
3 _mysql.c:30:26: error: structmember.h: No such file or directory
4 In file included from /usr/include/mysql/mysql.h:44,
5 from _mysql.c:40:
6 .
7 .
8 .
9 _mysql.c:2808: warning: return type defaults to 'int'
10 _mysql.c: In function 'DL_EXPORT':
11 _mysql.c:2808: error: expected declaration specifiers before 'init_mysql'
12 _mysql.c:2886: error: expected '{' at end of input
13 error: command 'gcc' failed with exit status 1
Installing the python-dev package on Debian is done with apt-get or synaptic:
1 apt-get install python-dev
Pasted from <http://snippets.aktagon.com/snippets/211-How-to-install-and-use-the-mysql-python-library>