Ubuntu中的Python-MySQLdb错误
作者:互联网
我正在尝试在Ubuntu中设置环境(从
MS-Windows).
它当然具有Python 2.6.
我确实从“ Ubuntu软件中心”设置了MySQL 5512和MySQLdb.
import dabo
import MySQLdb
工作正常.没错
但是在建立连接时,据说在
MySQLdb&的版本_mysql.
ImportError: this is MySQLdb version (1, 2, 3, 'gamma', 1), but _mysql
is version (1, 2, 2, 'final', 0)
我该如何解决?
完成回溯—->
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "dabovmd/hotel.py", line 4, in <module>
empconn = dabo.db.dConnection(empci)
File "dabo/db/dConnection.py", line 32, in __init__
self._connection = self._openConnection(**kwargs)
File "dabo/db/dConnection.py", line 80, in _openConnection
return
self._connectInfo.getConnection(forceCreate=self._forceCreate, **kwargs)
File "dabo/db/dConnectInfo.py", line 105, in getConnection
return self._backendObject.getConnection(self, **kwargs)
File "dabo/db/dbMySQL.py", line 25, in getConnection
import MySQLdb as dbapi
File "/media/pyth/python26/Lib/site-packages/MySQLdb/__init__.py",
line 23, in <module>
(version_info, _mysql.version_info))
ImportError: this is MySQLdb version (1, 2, 3, 'gamma', 1), but _mysql
is version (1, 2, 2, 'final', 0)
提前致谢,
藤蔓
解决方法:
这似乎是您的MySQL服务器与python-mysqldb之间的版本不匹配.
您正在使用哪个版本的Ubuntu? (如果您最近转移了,请尝试使用Ubuntu 11.04).
解决问题的最简单方法是将ubuntu更新到至少11.04,然后安装匹配版本的mysql-server和python-mysqldb.
我正在使用Ubuntu 11.04,我的mysql服务器版本是5.1.54-1ubuntu4,我的python-mysqldb版本是1.2.2-10build2.
希望这可以帮助
标签:ubuntu,mysql-python,python 来源: https://codeday.me/bug/20191202/2086512.html