Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

python - Import "flask" could not be resolved from source Pylance (reportMissingModuleSource)

When I am writing

from flask import Flask

One Yellow line is coming up under flask and stating Import "flask" could not be resolved from source Pylance (reportMissingModuleSource) . Also, I am able to do the work with this package also successfully. But the thing is, I am not able to use autosuggesstions for Classes and methods very well.

Further:

  1. I have checked that flask is installed successfully.
  2. Also I visited this thread https://github.com/microsoft/pylance-release/issues/236

And I set up my settings.json in vscode as follows:

"python.analysis.extraPaths": [
    "/media/sarimurrab/New Volume/COURSES/Flask/FlaskMigrateforDatabaseMigrations/2"
]

But Still, unable to resolve the error.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When I did not install the module "flask" in the Python environment currently used in VSCode:

enter image description here

Please use the command "pip --version" to check the source of the module installation tool "pip", the module is installed at this location:

enter image description here

Then, we can use the command "pip show flask" to check the installation location of the module "flask": (It checks whether the installation location of the module is consistent with the Python environment displayed in the lower left corner of VSCode.)

enter image description here

If the "reportMissingModuleSource" message is still displayed here, please reload VS Code.

(F1, Developer: Reload Window)

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...