MySQLdb DeprecationWarning: the sets module is deprecated from sets import ImmutableSet


出现这问题一般都已经配置好了mysql,如果没有的话在博客中搜索:

python mysqlLdb ImportError: DLL load failed: 找不到指定的模块 这篇文章下载安装包

安装完后打开X:/python26/Lib/site-packages/MySQLdb/文件夹

1:将__init__.py中的:

*注释第34行: from sets import ImmutableSet

*在后面一行添加: ImmutableSet = frozenset

*注释第41行e: from sets import BaseSet

*在后面一行添加: BaseSet = set

------------------------------------------------

from sets import ImmutableSet 

class DBAPISet(ImmutableSet):

改为:class DBAPISet(frozenset) :

2:将converters.py中的:

from sets import BaseSet, Set  这句删除

48行左右的 return Set([ i for i in s.split(',') if i ]) 改为 return set([ i for i in s.split(',') if i ])

将128行左右的 Set: Set2Str 改为 set Set2Str

以上是网上查到的,不过我在改动的过程中是将128行左右的 Set: Set2Str 改为 set: Set2Str

#from sets import BaseSet, Set
BaseSet = set


你可能感兴趣的:(mysql,python,Module,dll,import,deprecated)