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



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章