我正在尝试将我的raspberry pi连接到一个MySQL数据库,不幸的是我无法将其连接。错误是:
pi@raspberrypi:~ $ python HexCodeImporter2.py
Traceback (most recent call last):
File "HexCodeImporter2.py", line 1, in <module>
import mySQL.connector
ImportError: No module named mySQL.connector
pi上用于将数据发送到服务器的代码如下:
^{pr2}$我试图下载mySQL.connector但运气不好。我怎么能这么做?在
我不知道python,但我突然想到的是,你没有调用正确的变量名。在
import mySQL.connector
可能是:
import con
,因为“con”是保存mysql连接细节的变量。在如果不是pdo,您还应该从旧的标准mysql迁移到至少mysqli(改进的)
我相信从Python连接到MySQL数据库的首选方法是MySQLdb
如果MySQLdb没有安装,不用担心,这是一个快速安装。在
任何按以下方式编写代码
相关问题 更多 >
编程相关推荐