这个程序在Ubuntu 10上运行得很好,但在我的Debian 8上就不行了。
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import mysql.connector
conn = mysql.connector.connect(
user='eric',
password='***',
host='localhost',
database='eric'
)
curs = conn.cursor(dictionary=True)
错误
Traceback (most recent call last):
File "./exo.py", line 19, in <module>
curs = conn.cursor(dictionary=True)
TypeError: cursor() got an unexpected keyword argument 'dictionary'
环境
pip3 list|grep mysql -> None
dpkg -l|grep mysql|grep python
ii python3-mysql.connector 1.2.3-2 all pure Python implementation of MySQL Client/Server protocol (Python3)
你能帮我吗?谢谢
发布于 2021-06-03 19:58:29
感谢snakecharmed ..。
https://dev.mysql.com/doc/relnotes/connector-python/en/news-2-0-0.html
mysql.connector.cursor模块支持四个新的游标类:
MySQLCursorDict游标类将每行作为字典返回。每个字典对象的键都是MySQL的列名
结果。
cursor = cnx.cursor(dictionary=True)
因此,在1.2.3版本的mysql.connector上不存在dictionnary=True
https://stackoverflow.com/questions/67817829
复制相似问题