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



本文出自 “稀饭” 博客,请务必保留此出处http://zunfengke.blog.51cto.com/6285721/1398879

MySQL-Python 安装,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。