在Windows上安装Python+MySQL 的常见问题及解决方法
验证是否已经安装了MySQLdb:
==========================================================
d:\usr\local\Python25>python
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] onwin32
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb
==========================================================
如果有类似于上面的"No module named MySQLdb",表明MySQLdb尚未安装或安装的不成功!
MySQL 版本:5.0.67
下载地址:http://dev.mysql.com/downloads/mysql/5.0.html#downloads
下载exe文件并安装
==========================================================
Python 版本:2.5
下载地址:http://www.python.org/download/releases/2.5.4/
下载msi文件并安装
MySQLdb版本: MySQLdb Windows binary for Python 2.5
下载地址:http://biohackers.net/wikiattach/Python2(2e)5/attachments/MySQL-python.exe-1.2.1_p2.win32-py2.5.exe
参见:http://forums.mysql.com/read.php?50,129618,140611#msg-140611
常见问题:
1.无法定位程序输入点 mysql_server_init 于动态链接库 LIBMYSQL.dll 上。
----------------------------------------------------------------------------------------------------
D:\usr\local\Python25>python
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 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:\usr\local\Python25\Lib\site-packages\MySQLdb\__init__.py", line 19, in <module>
import _mysql
ImportError: DLL load failed: 找不到指定的程序。
----------------------------------------------------------------------------------------------------
解决方法:把mysql安
相关文档:
代码很简单,不到5k行。但是思路挺好的,改成non-blocking了之后效率就是能提高不少,特别是考虑到现代的web app都需要和其他的
HTTP服务器通信,blocking的代价太大了。 Tornado is an open source version of the scalable, non-blocking web server and tools that power FriendFeed. The FriendFeed application ......
源代码下载:下载地址在这里
# 025
# 序列的神奇之处在于你可以使用相同的方式tuple、list和string
se = ['a', 'b', 'c', 'd']
li = ['a', 'b', 'c', 'd']
tu = ('a', 'b', 'c', 'd')
string = 'abcd'
print se[1]
print li[1]
print tu[1]
print string[1]
# 序列的另外一个神奇之处在于,你可以使用负数进行索 ......
# 040
import time
try:
f = file('040_Finally.py')
while True:
line = f.readline()
if len(line) == 0:
break
time.sleep(0.33)
print line,
# end of while
finally:
f.close()
print 'Closed the file.'
# end of try
output:
> ......