简体   繁体   English

导入“flask_mysqldb”无法解析 Pylance(reportMissingImports)

[英]Import "flask_mysqldb" could not be resolved Pylance(reportMissingImports)

Uhh, well I get this error嗯,我收到这个错误

Import "flask_mysqldb" could not be resolved Pylance(reportMissingImports)导入“flask_mysqldb”无法解析 Pylance(reportMissingImports)

And I don't really know if I'm missing something because when I try to install stuff it says "requirement already fulfilled" and I'm panicking because I don't know what I'm doing wrong.而且我真的不知道我是否遗漏了什么,因为当我尝试安装东西时,它说“要求已经满足”,我很恐慌,因为我不知道我做错了什么。 This is the actual code I'm working with but I can't use anything related to databases because the 2nd line doesn't work:这是我正在使用的实际代码,但我不能使用与数据库相关的任何内容,因为第二行不起作用:

from flask import Flask, render_template, request, redirect, url_for, flash

from flask_mysqldb import MySQL

Please make sure you have installed the package into the environment which you have selected.请确保您已将 package 安装到您选择的环境中。

You can get which python interpreter you are using from the bottom-left on the VSCode:您可以从 VSCode 的左下角获取正在使用的 python 解释器:

在此处输入图像描述

And which pip you are using in the terminal with the command of pip --version .以及您在终端中使用pip --version命令使用的是哪个 pip。

Normally, after you select the python interpreter in the VSCode, you should create a new terminal with the shortcut of Ctrl+Shift+` , then you can install the package into the environment which you have selected.通常,在 VSCode 中 select python 解释器之后,您应该使用Ctrl+Shift+`快捷方式创建一个新终端,然后您可以将 package 安装到您选择的环境中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 导入无法解析 Pylance(reportMissingImports) - Import could not be resolved Pylance(reportMissingImports) 导入“selenium”无法解析 Pylance(reportMissingImports) - Import "selenium" could not be resolved Pylance (reportMissingImports) "导入“spacy”无法解决 Pylance (reportMissingImports)" - Import "spacy" could not be resolved Pylance (reportMissingImports) 在 Mac 上的 VSCode 中无法解决导入“pygame”的 Pylance (reportMissingImports) 错误 - Import "pygame" could not be resolved Pylance (reportMissingImports) error in VSCode on mac 无法从源代码解析导入 flask - import flask could not be resolved from source pylance 错误:导入 tensorflow.keras.backend 作为 K 无法解析 Pylance(reportMissingImports) - Error: import tensorflow.keras.backend as K could not be resolved Pylance(reportMissingImports) 无法解析导入“.utils”(reportMissingImports) - Import ".utils" could not be resolved(reportMissingImports) 无法从来源解析导入“flask_sqlalchemy”:Pylance - Import "flask_sqlalchemy" could not be resolved from source: Pylance 无法从源 Pylance (reportMissingModuleSource) 解析导入“flask” - Import "flask" could not be resolved from source Pylance (reportMissingModuleSource) ImportError: No module named flask_mysqldb ("from flask_mysqldb import MySQL") - ImportError: No module named flask_mysqldb ("from flask_mysqldb import MySQL")
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM