Django MySQLdb version doesn't match _mysql version Ubuntu

故事扮演 提交于 2019-11-28 07:47:02

问题


I'm trying to get a django site deployed from a repository. I was almost there, and then changed something (I'm not sure what!!) and was back to square one.

Now I'm trying to run ./manage.py syncdb and get the following error:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: this is MySQLdb version (1, 2, 3, 'final', 0), but _mysql is version (1, 2, 2, 'final', 0)

I've searched forums for hours and none of the solutions presented helped. I tried uninstalling and re-installing MySQL-python and upgrading it. I get the same error when trying to import it from the python command line interpreter.

Does anyone have any suggestions?


回答1:


I got the same problem after installing mysql-python using pip. Seems to be an error in the pip package. I solved it by pip uninstall'ing it again, after which i downloaded and installed the package manually like this:

  • # download from http://sourceforge.net/projects/mysql-python
  • $ tar xfz MySQL-python-1.2.3.tar.gz (replace with newest version)
  • $ cd MySQL-python-1.2.3
  • $ python setup.py build
  • $ sudo python setup.py install



回答2:


For those who come upon this question:

It turns out that ubuntu _mysql version was different from the one in my venv. Uninstalling that and re-installing in my venv did the trick.



来源:https://stackoverflow.com/questions/7137214/django-mysqldb-version-doesnt-match-mysql-version-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!