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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值