[英]Importing _mysql in MySQLdb
Why is _mysql in the MySQLdb module a C file? 为什么MySQLdb模块中的_mysql是C文件? When the module tries to import it, I get an import error. 当模块尝试导入它时,出现导入错误。 What should I do? 我该怎么办?
It's the adaptor that sits between the Python MySQLdb
module and the C libmysqlclient
library. 它是位于Python MySQLdb
模块和C libmysqlclient
库之间的适配器。 One of the most common reasons for it not loading is that the appropriate libmysqlclient library is not in place. 不能加载它的最常见原因之一是没有适当的libmysqlclient库。
Edit : This might be the answer to your question. 编辑 : 这可能是您问题的答案。
When I try to import _mysql
, I get no error: 当我尝试导入_mysql
,没有错误:
import _mysql
print(_mysql)
# <module '_mysql' from '/usr/lib/pymodules/python2.6/_mysql.so'>
It is importing the library /usr/lib/pymodules/python2.6/_mysql.so 它正在导入库/usr/lib/pymodules/python2.6/_mysql.so
If this is not what you are getting, it sounds like an installation error. 如果这不是您要得到的,这听起来像是安装错误。 What OS are you using? 您正在使用什么操作系统? How did you install mysqldb? 您如何安装mysqldb?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.