免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
python2.6.2 + MySQLdb - 十月 - 博客大巴

python2.6.2 + MySQLdb - [編程學(xué)習(xí)]

2010-03-15

版權(quán)聲明:轉(zhuǎn)載時(shí)請(qǐng)以超鏈接形式標(biāo)明文章原始出處和作者信息及本聲明
http://octoberken.blogbus.com/logs/60528403.html

最近想做點(diǎn)兒東西,需要用到python進(jìn)行mysql數(shù)據(jù)庫(kù)操作。

無(wú)奈,目前python的myql庫(kù)只支持到python2.5.2.而我現(xiàn)在用的是2.6.2,于是在網(wǎng)上搜索了一下,果然找到了配置方法。

作為一個(gè)好學(xué)的人。。我忍不住想轉(zhuǎn)載過來(lái)跟大家分享一下。要是原作者有異議,請(qǐng)及時(shí)聯(lián)系我。

原文地址:http://www.3gmatrix.cn/4/viewspace-16757.html

內(nèi)容如下:

—————————————轉(zhuǎn)載開始————————————————

 

Python 版本:2.6
下載地址:http://www.python.org/download/releases/2.6.2/
下載msi文件并安裝

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
參見:http://sourceforge.net/forum/forum.php?thread_id=2316047&forum_id=70460

常見問題:
1.ImportError: DLL load failed: 找不到指定的模塊。
—————————————————————————————————-
D:\Program Files\Python2.6>python
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [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 “<stdin>”, line 1, in <module>
  File “D:\Program Files\Python2.6\Lib\site-packages\MySQLdb\__init__.py”, line 19, in <module>

    import _mysql
ImportError: DLL load failed: 找不到指定的模塊。
—————————————————————————————————-
解決方法:下載libmmd.dll(附件)和libguide40.dll(附件)兩個(gè)dll文件并復(fù)制到python安裝目錄的Lib\site-packages下。
參見:http://sourceforge.net/forum/message.php?msg_id=5613887

2.ImportError: DLL load failed: 找不到指定的模塊。
—————————————————————————————————-
D:\Program Files\Python2.6>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
D:\Program Files\Python2.6\lib\site-packages\MySQLdb\__init__.py:34: DeprecationWarning: the sets module is deprecated
  from sets import ImmutableSet
—————————————————————————————————-
解決方法:
1) file “__init__”, replace: 
 
from sets import ImmutableSet  
class DBAPISet(ImmutableSet):  
 
with  
 
class DBAPISet(frozenset) 
 
2) file “converters.py”, remove: 
 
from sets import BaseSet, Set 
 
3) file “converters.py”, change “Set” by “set” (IMPORTANT: only two places): 
 
line 48: return set([ i for i in s.split(',') if i ]) 
line 128: set: Set2Str, 
參見:http://sourceforge.net/forum/message.php?msg_id=5808948

 

————————————————轉(zhuǎn)載結(jié)束??!———————————

關(guān)于最后這個(gè),怕一些同學(xué)看不太明白,俺做一下解釋

1)打開python安裝目錄下面的D:\Python26\Lib\site-packages\MySQLdb 文件夾,編輯里面的__init__.py文件。

找到里面的

from sets import ImmutableSet  
class DBAPISet(ImmutableSet): 

這兩句,然后把這兩行 變成這一行:class DBAPISet(frozenset)


2)打開文件converters.py,刪掉里面的from sets import BaseSet, Set 這一行

3)替換converters.py文件里面的Set為set,主要有兩處,48行 128行

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
python連接mysql時(shí) 出現(xiàn)DeprecationWarning: the sets...
windows上python和django開發(fā)環(huán)境的安裝和配置
python 包機(jī)制、導(dǎo)入模塊
刨根問底,完美解決Django2版本連接MySQL報(bào)錯(cuò)的問題
Nginx+uWsgi+Django+Python+MongoDB+mySQL服務(wù)器搭建
python的包和模塊
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服