我正在尝试使用python在mysql数据库中保存hash_值。我已获得哈希值hash = imagehash.dhash(Image.open('temp_face.jpg'))
,但在执行insert查询cursor.execute("INSERT INTO image(hash,name,photo) VALUES(%d,%s,%s )", (hash,name, binary_image))
之后,它给了我错误“Python'imagehash'无法转换为MySQL类型”
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+-------------------+-------------------+
| hash | binary(32) | NO | PRI | NULL | |
| name | varchar(25) | NO | | NULL | |
| photo | blob | NO | | NULL | |
| arrival | datetime | NO | | CURRENT_TIMESTAMP | DEFAULT_GENERATED |
+---------+-------------+------+-----+-------------------+-------------------+
那么,可以做些什么来存储值,或者是否有其他方法来完成相同的任务
目前没有回答
相关问题 更多 >
编程相关推荐