安装自定义应用程序时出现“加载 MySQLdb 模块时出错”

安装自定义应用程序时出现“加载 MySQLdb 模块时出错”

我正在安装一个需要 MySQL 的自定义应用程序,我已经在运行它了,所以我对发生的事情有点困惑。

无论如何,这里是错误:

Error loading MySQLdb module: this is MySQLdb version (1, 2, 4, 'final', 1),
  but _mysql is version (1, 2, 3, 'final', 0

尝试过

sudo pip uninstall MySQL-python

然后

sudo pip install MySQL-python

有效……

Successfully installed MySQL-python

还是同样的错误

Error loading MySQLdb module: this is MySQLdb version (1, 2, 4, 'final', 1), 
  but _mysql is version (1, 2, 3, 'final', 0

答案1

看来apt-getpip 各自安装了自己版本的库。

尝试使用 删除系统 MySQL sudo apt-get remove python-mysqldb,你应该得到如下结果:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  python-mysqldb
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
After this operation, 196 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 109333 files and directories currently installed.)
Removing python-mysqldb (1.2.3-2ubuntu1) ...

相关内容