ModuleNotFoundError: 没有名为 'mysql' 的模块 [英] ModuleNotFoundError: No module named 'mysql'

查看:63
本文介绍了ModuleNotFoundError: 没有名为 'mysql' 的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用 Python Cgi 脚本在 sql 中存储值,我已经成功下载了 MySQL 的连接器/Python.我在 Python 的 shell 中使用了以下代码来测试我的连接:

Trying to store values in sql using Python Cgi script, I have downloaded the Connector/Python for MySQL successfully. I used the following code in Python's shell to test my connection:

import mysql.connector

我收到以下错误消息:

ModuleNotFoundError: No module named 'mysql'

尝试导入 MySQL.connector 时.

when trying to import MySQL.connector.

推荐答案

试试这个命令:

pip install mysql-connector-python-rf

pip install mysql-connector-python-rf

然后再试一次你的命令,它会正确运行.

then try your command again, it'll run correctly.

这篇关于ModuleNotFoundError: 没有名为 'mysql' 的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆