Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
eclipse中MySQL的python问题_Python_Mysql_Eclipse_Pydev_Mysql Python - Fatal编程技术网

eclipse中MySQL的python问题

eclipse中MySQL的python问题,python,mysql,eclipse,pydev,mysql-python,Python,Mysql,Eclipse,Pydev,Mysql Python,例如: import MySQLdb conn = MySQLdb.connect(passwd="passwd", db="mydb") cursor = conn.cursor() cursor.execute("""SELECT * FROM table""") records = cursor.fatchone() print records 提供下一个错误: 回溯(最近一次调用):文件 “/Applications/eclipse/plugins/org.python.pydev.d

例如:

import MySQLdb
conn = MySQLdb.connect(passwd="passwd", db="mydb")
cursor = conn.cursor()
cursor.execute("""SELECT * FROM table""")
records = cursor.fatchone()
print records
提供下一个错误:

回溯(最近一次调用):文件
“/Applications/eclipse/plugins/org.python.pydev.debug_2.2.2.2011100512/pysrc/pydevd.py”,
第1267行,在
run(setup['file'],None,None)文件“/Applications/eclipse/plugins/org.python.pydev.debug_2.2.2.2011100512/pysrc/pydevd.py”, 第1020行,运行中
pydev_imports.execfile(file,globals,locals)#执行脚本文件“/Users/user/Documents.Develop/workspace/myProject/src/Main.py”,
第56行,在
导入MySQLdb文件“build/bdist.macosx-10.7-intel/egg/MySQLdb/init.py”,第19行,在
文件“build/bdist.macosx-10.7-intel/egg/_mysql.py”,第7行,
在文件“build/bdist.macosx-10.7-intel/egg/_mysql.py”中,行
6,在引导中导入错误:
dlopen(/Users/user/.python-eggs/MySQL_-python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_-MySQL.so,
2) :未加载库:libmysqlclient.18.dylib引用自:
/Users/user/.python-eggs/MySQL\u python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/\u-MySQL.so
原因:找不到图像


错误在哪里?

错误似乎在这里:

未加载库:libmysqlclient.18.dylib引用自:

确保安装mysqldb库。
请参阅:
和/或:

代码中还存在语法错误:

records = cursor.fatchone() 
--> should be
records = cursor.fetchone() 

也许
records=cursor.fatchone()
应该是
records=cursor.fetchone()