由于使用pip安装MySQL-python可能导致的问题是本地python是64bit,pip安装的MySQL-python是32bit。下载地址:https://pan.baidu.com/s/1jBv_mE1nWwhUDka2xZ7V-Q
报错如下:


点击(此处)折叠或打开

  1. C:\Users\SongHyun>python
  2. Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (
  3. AMD64)] on win32
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>> import MySQLdb
  6. Traceback (most recent call last):
  7.   File "", line 1, in <module>
  8.   File "D:\python2.7.11\lib\site-packages\MySQLdb\__init__.py", line 19, in <mod
  9. ule>
  10.     import _mysql
  11. ImportError: No module named _mysql


  12. C:\Users\SongHyun>python
  13. Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (
  14. AMD64)] on win32
  15. Type "help", "copyright", "credits" or "license" for more information.
  16. >>> import MySQLdb
  17. >>>

09-17 18:35