ImportError: No module named MySQLdb
windows的环境总是有些奇葩的说,Ubuntu下倒是好办,直接使用下面代码:
$sudo apt-get install python-mysqldb
那么windows呢就需要一点手段,安装Microsoft Visual C++ Compiler for Python 2.7 这么个东西,链接如下
==Microsoft Visual C++ Compiler for Python 2.7==
然后我们用这个命令在命令行中执行
python -m pip install MySQL-python
会出现如下错误:
_mysql.c(42) : fatal error C1083: Cannot open include file: \'config-win.h\': No such file or directory
那么经过一番搜索,发现我们还有需要安装这个驱动,链接如下
===============MySQL-python===============
那么至此非常神奇的发现环境已经OK