ModulenotFoundError:No模块名为' mysql'尽管多次尝试解决

发布于 2025-01-27 03:44:33 字数 273 浏览 4 评论 0原文

我似乎还是不断面对这个错误

  • :通过“ Python -M PIP安装MySQL-Connector-Python”
  • 安装MySQL软件包,

尽管以下内容 “每次我在终端再次运行它时已经满足需求”。此外,我也尝试安装和重新安装包装。

但是所有结果都是相同的。每次运行脚本并尝试“导入mysql.connector”时,我总是会得到ModulenotFoundError:没有名为'MySQL'错误的模块

都会非常感谢您的帮助。非常感谢

I seem to be facing this error continuously despite:

  • Installing the mysql-connector via "python -m pip install mysql-connector-python"
  • Installing the MySQL package via "pip install MySQL"

I have confirmed that I have installed the package as it says "Requirement already satisfied everytime I run it again in the terminal". Additionally, I have tried installing and reinstalling the package as well.

But all the results are the same. Each time I run my script and try to "import mysql.connector", I always get the ModuleNotFoundError: No module named 'mysql' error

Would greatly appreciate some help. Thank you very much

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小清晰的声音 2025-02-03 03:44:33

您使用虚拟环境吗?如果是虚拟环境,请将虚拟环境的扩展软件包文件夹中的内容复制到Python下的软件包文件夹。

如果您的系统中有两个版本的Python,则可能会遇到此问题。 “ Ctrl+Shift+P”,然后选择正确的解释器。

您可以使用以下方法检查并查看PIP安装的软件包:

pip show MySQL

Do you use virtual environments? If it is a virtual environment, please copy the contents in the expansion package folder of the virtual environment to the package folder under python.

If you have two versions of Python in your system, you may also encounter this problem. "CTRL+SHIFT+P" and choose the correct interpreter.

enter image description here

You can use the following method to check and see where pip installed the package:

pip show MySQL
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文