Install Django/mysqldb under snow leopard 10.6.2

Source: Internet
Author: User
Tags install django

During the Spring Festival, I studied the Django framework and made some reserves for this year's Internet applications.

I have been using python for two years before, so it is not difficult to get started, but I encountered a problem in implementing Django persistence.

Django supports a variety of databases, including PostgreSQL, MySQL, and Oracle. For convenience, the most common open source MySQL is used. Therefore, mysqldb needs to be installed.

In my operating system, snow leopard 10.6.2. python is installed by default, and MySQL is installed again.

Download mysql-python-1.2.3c1.tar.gz, and then

CD MySQL-python-1.2.3c1
Python setup. py build
Sudo Python setup. py install
Everything goes smoothly. Execute:
$ Pythonpython 2.6.1 (r261: 67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwintype "help", "Copyright", "Credits" or "License" for more information. >>> import mysqldb
Error:
Traceback (most recent call last): file "", line 1, in file "build/bdist. macosx-10.5-i386/egg/mysqldb/_ init __. PY ", line 19, in importerror: dynamic module does not define init function (init_mysql)
I googled it and found that MySQL and Python may have 32-bit 64-bit problems. I checked the system and found that the Mac OS comes with 64-bit python. I installed MySQL with 32-bit, the problem is found. Reinstall the 64-bit MySQL, delete the files under the build, re-build and install, and everything went smoothly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.