<tfoot id='KdyOk'></tfoot>
    1. <i id='KdyOk'><tr id='KdyOk'><dt id='KdyOk'><q id='KdyOk'><span id='KdyOk'><b id='KdyOk'><form id='KdyOk'><ins id='KdyOk'></ins><ul id='KdyOk'></ul><sub id='KdyOk'></sub></form><legend id='KdyOk'></legend><bdo id='KdyOk'><pre id='KdyOk'><center id='KdyOk'></center></pre></bdo></b><th id='KdyOk'></th></span></q></dt></tr></i><div id='KdyOk'><tfoot id='KdyOk'></tfoot><dl id='KdyOk'><fieldset id='KdyOk'></fieldset></dl></div>
          <bdo id='KdyOk'></bdo><ul id='KdyOk'></ul>
        <legend id='KdyOk'><style id='KdyOk'><dir id='KdyOk'><q id='KdyOk'></q></dir></style></legend>

        <small id='KdyOk'></small><noframes id='KdyOk'>

        如何在 OSX 10.6 中将 MySQLdb 与 Python 和 Django 一起使用?

        时间:2023-05-24
        <legend id='a9Ud8'><style id='a9Ud8'><dir id='a9Ud8'><q id='a9Ud8'></q></dir></style></legend>
          <tbody id='a9Ud8'></tbody>
      1. <i id='a9Ud8'><tr id='a9Ud8'><dt id='a9Ud8'><q id='a9Ud8'><span id='a9Ud8'><b id='a9Ud8'><form id='a9Ud8'><ins id='a9Ud8'></ins><ul id='a9Ud8'></ul><sub id='a9Ud8'></sub></form><legend id='a9Ud8'></legend><bdo id='a9Ud8'><pre id='a9Ud8'><center id='a9Ud8'></center></pre></bdo></b><th id='a9Ud8'></th></span></q></dt></tr></i><div id='a9Ud8'><tfoot id='a9Ud8'></tfoot><dl id='a9Ud8'><fieldset id='a9Ud8'></fieldset></dl></div>
          • <bdo id='a9Ud8'></bdo><ul id='a9Ud8'></ul>
            <tfoot id='a9Ud8'></tfoot>

                • <small id='a9Ud8'></small><noframes id='a9Ud8'>

                • 本文介绍了如何在 OSX 10.6 中将 MySQLdb 与 Python 和 Django 一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  对于 OSX 10.6 用户来说,这是一个讨论较多的问题,但我一直找不到有效的解决方案.这是我的设置:

                  This is a much discussed issue for OSX 10.6 users, but I haven't been able to find a solution that works. Here's my setup:

                  Python 2.6.1 64 位Django 1.2.1MySQL 5.1.47 osx10.6 64 位

                  Python 2.6.1 64bit Django 1.2.1 MySQL 5.1.47 osx10.6 64bit

                  我使用 --no-site-packages 创建了一个 virtualenvwrapper,然后安装了 Django.当我激活 virtualenv 并运行 python manage.py syncdb 时,出现此错误:

                  I create a virtualenvwrapper with --no-site-packages, then installed Django. When I activate the virtualenv and run python manage.py syncdb, I get this error:

                  Traceback (most recent call last):
                  File "manage.py", line 11, in <module>
                    execute_manager(settings)
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
                    utility.execute()
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
                    self.fetch_command(subcommand).run_from_argv(self.argv)
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/__init__.py", line 257, in fetch_command
                    klass = load_command_class(app_name, subcommand)
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/__init__.py", line 67, in load_command_class
                    module = import_module('%s.management.commands.%s' % (app_name, name))
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
                    __import__(name)
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 7, in <module>
                  from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/core/management/sql.py", line 5, in <module>
                  from django.contrib.contenttypes import generic
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/contrib/contenttypes/generic.py", line 6, in <module>
                    from django.db import connection
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/db/__init__.py", line 75, in <module>
                    connection = connections[DEFAULT_DB_ALIAS]
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/db/utils.py", line 91, in __getitem__
                    backend = load_backend(db['ENGINE'])
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/db/utils.py", line 32, in load_backend
                    return import_module('.base', backend_name)
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
                    __import__(name)
                  File "/Users/joerobinson/.virtualenvs/dj_tut/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
                    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
                  django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
                  

                  我还安装了 MySQL for Python 适配器,但无济于事(也许我安装不正确?).

                  I've also installed the MySQL for Python adapter, but to no avail (maybe I installed it improperly?).

                  以前有人处理过这个吗?

                  Anyone dealt with this before?

                  推荐答案

                  此问题是由于 MySQL for Python 适配器安装不完整/不正确造成的.具体来说,我必须编辑 mysql_config 文件的路径以指向/usr/local/mysql/bin/mysql_config - 在本文中进行了更详细的讨论:http://dakrauth.com/blog/entry/python-and-django-setup-mac-os-x-豹子/

                  This issue was the result of an incomplete / incorrect installation of the MySQL for Python adapter. Specifically, I had to edit the path to the mysql_config file to point to /usr/local/mysql/bin/mysql_config - discussed in greater detail in this article: http://dakrauth.com/blog/entry/python-and-django-setup-mac-os-x-leopard/

                  这篇关于如何在 OSX 10.6 中将 MySQLdb 与 Python 和 Django 一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何检查特定表的 MySQL 引擎类型? 下一篇:MySQL:在同一个 MySql 实例上克隆一个 MySQL 数据库

                  相关文章

                • <small id='YnvYO'></small><noframes id='YnvYO'>

                    <bdo id='YnvYO'></bdo><ul id='YnvYO'></ul>
                  <legend id='YnvYO'><style id='YnvYO'><dir id='YnvYO'><q id='YnvYO'></q></dir></style></legend>
                • <i id='YnvYO'><tr id='YnvYO'><dt id='YnvYO'><q id='YnvYO'><span id='YnvYO'><b id='YnvYO'><form id='YnvYO'><ins id='YnvYO'></ins><ul id='YnvYO'></ul><sub id='YnvYO'></sub></form><legend id='YnvYO'></legend><bdo id='YnvYO'><pre id='YnvYO'><center id='YnvYO'></center></pre></bdo></b><th id='YnvYO'></th></span></q></dt></tr></i><div id='YnvYO'><tfoot id='YnvYO'></tfoot><dl id='YnvYO'><fieldset id='YnvYO'></fieldset></dl></div>
                    <tfoot id='YnvYO'></tfoot>