Paty Pizá
Paty Pizá

Reputation: 19

Import "flask_mysqldb" could not be resolved Pylance(reportMissingImports)

Uhh, well I get this error

Import "flask_mysqldb" could not be resolved 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

Upvotes: 0

Views: 4087

Answers (3)

Bayu Hidayad
Bayu Hidayad

Reputation: 1

You can try installing the dependency via pip:

pip install flask_mysqldb 

Upvotes: 0

Paty Pizá
Paty Pizá

Reputation: 19

This was a while back but I'm vaguely sure it was an error that had to do with the enviroment and where I had stuff saved.

So if anyone has the same question I'd say track your program files and stuff.

Sorry I'm vague.

Upvotes: -1

Steven-MSFT
Steven-MSFT

Reputation: 8431

Please make sure you have installed the package into the environment which you have selected.

You can get which python interpreter you are using from the bottom-left on the VSCode:

enter image description here

And which pip you are using in the terminal with the command of pip --version.

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.

Upvotes: 0

Related Questions