为什么在VSCODE中不允许我导入mysql?

发布于 2025-01-24 08:00:34 字数 170 浏览 2 评论 0原文

大家好,你好吗,请谁可以给我一个解决方案:

import mysql.connector   ***Import "mysql.connector" could not be resolved***

当我尝试导入mysql.connector时,我会收到这个错误

Hello everyone how are you, please who can give me a solution to this:

import mysql.connector   ***Import "mysql.connector" could not be resolved***

when i try to import mysql.connector i get that error

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

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

发布评论

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

评论(1

灵芸 2025-01-31 08:00:35

1。问题的原因“导入”无法解决”

问题的原因是python.exe的路径文件夹中没有自定义模块,因此Python无法读取我们自定义模块的代码。

2。解决方案

将模块路径添加到当前编译的路径。

打开当前Floder的设置。

将以下代码添加到您的设置中。

 "python.analysis.extraPaths":[
    # Customize the path of the folder where the module is located. 
    "C:\\...\\...\\...\\..." # The path where your mysql stay

这是给出的

1. Causes of problem "Import "sth" could not be resolved"

The reason for the problem is that there is no customized module in the path folder of python.exe, so Python can't read the code of our customized module.

2. Solution

Add the module path to the currently compiled path.

Open the setting.json of current floder.

enter image description here

Add the following code into your setting.json

 "python.analysis.extraPaths":[
    # Customize the path of the folder where the module is located. 
    "C:\\...\\...\\...\\..." # The path where your mysql stay

]

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