Windows下MySQLdb安装
来源:互联网 发布:淘宝账号贷款的口子 编辑:程序博客网 时间:2024/05/22 19:05
下载与安装
Python中使用MySQL需要安装MySQLdb驱动,可以从官方站点下载:
http://sourceforge.net/projects/mysql-python/
目前支持最高Python版本号2.6,MySQL版本号5.1,详细描述如下:
MySQL support for Python. MySQL versions 3.23-5.1;and Python versions 2.3-2.6 are supported.
MySQLdb is the Python DB API-2.0 interface.
_mysql is a low-level API similiar to the MySQL C API.
ZMySQLDA is a Database Adapter for Zope2.
Windows下可以安装二进制版本的MySQLdb。
目前版本: MySQL-python-1.2.2.win32-py2.6.exe
下载地址:http://home.netimperia.com/files/misc/MySQL-python-1.2.2.win32-py2.6.exe
常见问题:
1.ImportError: DLL load failed: 找不到指定的模块。
C:\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 “C:\Python26\Lib\site-packages\MySQLdb\__init__.py”, line 19, in
import _mysql
ImportError: DLL load failed: 找不到指定的模块。
解决办法:我参考了 http://sourceforge.net/projects/mysql-python/forums/forum/70460/topic/2316047
需要下载libmmd.dll和libguide40.dll两个dll文件并复制到Python安装目录的Lib\site-packages下,链接在下面,你也可以谷歌一下:
libguide40.dll.zip
libmmd.dll.zip
2.被弃用的set模块,这个只是个警告,也可以不改
C:\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
C:\Python26\lib\site-packages\MySQLdb\__init__.py:34: DeprecationWarning: the sets module is deprecated
from sets import ImmutableSet
解决办法:要是每回都跳出来,那多不爽啊,set模块现在已经是内建的数据类型了,ImmutableSet现在成了frozenset。因此需要改成:
下面几个文件都在:F:\Python26\Lib\site-packages\MySQLdb目录下
1) file “__init__”:
from sets import ImmutableSet
class DBAPISet(ImmutableSet):
改为
class DBAPISet(frozenset) :
2) file “converters.py”, 删除:
from sets import BaseSet, Set
3) file “converters.py”, 将 “Set”改为“set” (IMPORTANT: 共有两处):
line 45: return set([ i for i in s.split(',') if i ])
line 129: set: Set2Str,
最新消息,你可以去这里下载没有任何问题的MySQLdb,国外的大牛所作:
MySQL-python Windows 64bit and 32bit distributions
转:http://www.cnblogs.com/yuxc/archive/2011/08/24/2152312.html
- Windows下MySQLdb安装
- Windows xp 下安装MySQLdb
- Windows下Python安装MySQLdb
- mysqldb windows下的安装问题
- windows 下安装 python 的 mysqldb 模块
- Windows+Python2.6下安装MySQLdb驱动
- Windows+Python2.7下安装MySQLdb驱动
- Windows下,安装MySQLdb 报错
- Windows下安装Python数据库模块--MySQLdb
- 在Windows下安装MySQLdb模块
- windows下安装python MySQLdb及问题解决
- windows下python 安装mysqldb模块
- Windows下使用pip安装MySQLdb
- Python 安装 MYSQLdb windows
- 【python】mysqldb Windows安装
- windows 安装MySQLdb
- 【Python】Windows下安装MySQLdb遇到的问题及解决方法
- Windows下安装MySQLdb遇到的问题及解决方法
- 15个很具代表性的MDX查询语句
- 润乾报表中隐藏行的使用
- ulimit 和 free 命令详解
- 黑马程序员_对于Java高新技术的学习笔记
- 由“游戏测试”引发“手机测试”的一些感想
- Windows下MySQLdb安装
- 突然的领悟
- MapXtreme 2005 了解新建MapXtreme项目结构(二)
- ubuntu 编译folly库
- linux字符串处理
- poj 1118 Lining Up
- android之Service
- poj 2606 Rabbit hunt
- COCOS2D中实现截图功能