Django - MySQLdb:找不到符号:_mysql_affected_rows [英] Django - MySQLdb: Symbol not found: _mysql_affected_rows

查看:950
本文介绍了Django - MySQLdb:找不到符号:_mysql_affected_rows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个同事从Django尝试使用MySQLdb时收到此错误消息:

A colleague got this error message when trying to use MySQLdb from Django:

[...]
ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: 
Error loading MySQLdb module: dlopen(/Users/roy/.python-eggs/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so, 2): 
Symbol not found: _mysql_affected_rows 
Referenced from: /Users/roy/.python-eggs/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so Expected in: dynamic lookup



他正在使用OS X 10.5,Python 2.5(使用OS X到达),MySQL 5.1和MySQLdb 1.2.3c1。

He's using OS X 10.5, Python 2.5 (arriving with OS X), MySQL 5.1 & MySQLdb 1.2.3c1.

任何想法如何攻击?

推荐答案

p>如果您安装mysql并且从头开始,它是Python绑定可能是最好的,当我在OS X 10.4或10.5上需要MySQLdb时,我使用以下步骤:

It might be best if you install mysql and it's Python bindings from scratch, I use the following steps whenever I need MySQLdb on OS X 10.4 or 10.5:


  1. 为您的安装 MySQL 系统中,dmg安装程序应该足够

  1. Install MySQL for your system, the dmg installer should be sufficient

MySQL的默认位置将在以下位置: /usr/local/mysql-5.0 0.45-osx10.4-i686的。从 / usr / local / mysql / lib 创建一个软链接:

The default location of MySQL will be somewhere around: /usr/local/mysql-5.0.45-osx10.4-i686. From /usr/local/mysql/lib, create a soft link:

ln -s ../../mysql-5.0.45-osx10.4-i686/lib mysql

下载<一个href =http://sourceforge.net/projects/mysql-python/files/ =nofollow noreferrer> MySQLdb源并解压缩

在您解压缩的MySQLdb目录下编辑文件 site.cfg ,注释掉 registry_key 并设置 mysql_config to:

Edit the file site.cfg under your unpacked MySQLdb directory, comment out the registry_key and set mysql_config to:

mysql_config = /usr/local/mysql-5.0.45-osx10 .4-i686 / bin / mysql_config

在MySQLdb目录中执行常规Python包构建:

Carry on with the regular Python packages build from within MySQLdb directory:

sudo python setup.py install

在上面是很好的,在新终端中测试MySQLdb:

If everything is fine above, test MySQLdb in a new terminal:

python -cimport MySQLdb

如果成功,上述内容将不会返回。上面的例子显示了OS 10.4和MySQL 5.0,用适当的工具版本代替它们。

The above should return nothing if successful. The above example shows OS 10.4 and MySQL 5.0, substitute them with the your proper tools version.

这篇关于Django - MySQLdb:找不到符号:_mysql_affected_rows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆