Link: Pylance Missing Imports Poetry
将输出的路径(如 ['/path/to/poetry/venv/lib/python3.12/site-packages'] )中的第一个值添加到 extraPaths :
If Poetry is not showing up in the list, you can grab the path directly from the source. www.markhneedham.com In your VS Code terminal, run: poetry env info --path Use code with caution. Copied to clipboard Copy the resulting path Go back to Python: Select Interpreter and choose
Now .venv/ is in your project root – VS Code often auto-detects it. pylance missing imports poetry link
poetry add requests
You can pass this path directly to Pylance via your VS Code settings so it knows where to look for third-party libraries. 将输出的路径(如 ['/path/to/poetry/venv/lib/python3
Non-invasive, works with existing Poetry setup. Cons: Requires maintaining absolute paths (or using $workspaceFolder but Poetry’s cache is often outside the project).
Troubleshooting Pylance: Fixing Missing Imports with Poetry in VS Code poetry add requests You can pass this path
import sys print(sys.path)