试图在ubuntu 12.10上安装python3x和sqlalchemy0.8的myql驱动程序.它失败并出现以下错误.
sudo pip-3.2 install oursql
Downloading/unpacking oursql
Running setup.py egg_info for package oursql
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build/oursql/setup.py", line 53
print "cython not found, using previously-cython'd .c file."
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build/oursql/setup.py", line 53
print "cython not found, using previously-cython'd .c file."
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
当我尝试安装cython时,我似乎已经拥有它:
sudo pip-3.2 …Run Code Online (Sandbox Code Playgroud) 我试图将python脚本生成的一些数据存储在MySQL数据库中.基本上我使用的命令:
con = oursql.connect(user="user", host="host", passwd="passwd",
db="testdb")
c = con.cursor()
c.executemany(insertsimoutput, zippedsimoutput)
con.commit()
c.close()
Run Code Online (Sandbox Code Playgroud)
哪里,
insertsimoutput = '''insert into simoutput
(repnum,
timepd,
...) values (?, ?, ...?)'''
Run Code Online (Sandbox Code Playgroud)
插入大约30,000行,大约有15列.以上大约需要7分钟.如果我使用MySQLdb而不是我们的MySQL,大约需要2秒钟.为何如此巨大的差异?这应该是在myql中以其他方式完成的,我们的自己的mysql只是很慢吗?如果有更好的方法用oursql插入这些数据,如果你能告诉我,我将不胜感激.
谢谢.