你在import MySQLdb时应该会报下面这个错是吧:
D:\usr\local\Python26>python
Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "", line 1, in
File "D:\usr\local\Python26\Lib\site-packages\MySQLdb\__init__.py", line 19, in
import _mysql
ImportError: DLL load failed: 找不到指定的模块。
解决方法:
下载libmmd.dll和libguide40.dll两个dll文件并复制系统的System32目录和python安装目录的Lib\site-packages之下。 再次import MySQLdb时就不会报错了。
如果遇到下面这个警告,没有关系不必理会:
Warning (from warnings module):
File "D:\Python26\lib\site-packages\MySQLdb\__init__.py", line 34
from sets import ImmutableSet
DeprecationWarning: the sets module is deprecated
libmmd.dll和libguide40.dll这两个文件 你可以在网上下载到,或者留下邮箱我发给你。
希望对你有所帮助。
取消
评论