MySQL-Python 安装

1. 安装Python-setuptools

wget --no-cookie --no-check-certificate http://pypi.python.org/packages/source/s/setuptools/setuptools-3.4.4.tar.gz
#(上面由于使用了https和ssl的原因,需要使用上面两个参数,否则不能下载,将会提示"Unable to establish SSl connection")
tar xzvf setuptools-3.4.4.tar.gz
cd setuptools-3.4.4
python setup.py build
python setup.py install


2.安装 python-devel


http://rpmfind.net/linux/rpm2html/search.php?query=python-devel( 下载对应版本)


3. 安装 MySQL-python

如果出现

Error: python-devel conflicts with python ?

Please try --


yum clean all
yum install yum-utils
yum-complete-transaction
yum update



wget--no-check-certificate https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b5.tar.gz


4. django 测试



# settings.py
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'test01',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': '127.0.0.1'
    }
}



python manage.py syncdb


[root@linux-ke test01]# python manage.py runserver 0.0.0.0:8000
Validating models...
0 errors found
April 20, 2014 - 09:47:35
Django version 1.6.2, using settings 'test01.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
[20/Apr/2014 09:47:42] "GET / HTTP/1.1" 200 1757
[20/Apr/2014 09:47:44] "GET / HTTP/1.1" 200 1757



你可能感兴趣的:(mysql-python)