首页 > 解决方案 > 使用 Django 时 VS Code 中的 pylance(reportMissingModuleSource) 错误

问题描述

https://github.com/microsoft/pyright/blob/master/docs/configuration.md" 错误指向此 GitHub 自述文件,没有说明,也没有针对此错误给出解决方案 显示的错误消息

我再次重新安装 python 和 Django 仍然无法正常工作。我应该怎么办?

标签: pythondjangopylance

解决方案


This could be because you are not using the correct python interpreter for your venv.

To select the interpreter: "View" > "Command Palette" or (Ctrl+Shift+P) and search and select "Python: Select Interpreter".

Then enter the path to the correct Python interpreter in your venv. Example:

./.venv/bin/python3

More here: https://code.visualstudio.com/docs/python/tutorial-django#_create-a-project-environment-for-the-django-tutorial


推荐阅读