【python+mysql】在python中调用mysql出问题 ImportError: No module named MySQLdb.constants
遇到如下异常:
File "C:\Users\Neil\PycharmProjects\ScrapyDouban\book\book\database.py", line 4, in
import torndb
File "h:\python\python27\lib\site-packages\torndb.py", line 33, in
import MySQLdb.constants
ImportError: No module named MySQLdb.constants
解决方法:
从 https://pypi.python.org/pypi/MySQL-python/1.2.5 中下载 MySQL-python-1.2.5.win32-py2.7.exe 并运行即可
上面只有32位的,下面这个链接里有32/64bit
http://www.codegood.com/archives/129
在运行 MySQL-python-1.2.5.win32-py2.7.exe 过程中,出现 Python version 2.7 required, which was not found in the registry问题,解决方法见 http://blog.csdn.net/zklth/article/details/8117207