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

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

问题描述

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

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安装mysql-connector-python-rf

pip install mysql-connector-python-rf

然后再次尝试您的命令,它将正确运行.

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

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

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