I have a bunch of small Python projects, each of which is just a few files, so I put them all in one git repo. I always open VS Code to the root of this repo so I don't have to keep duplicating settings and launch config, etc. It looks like this:
.
├── .git
├── .vscode
│ ├── launch.json
│ ├── settings.json
├── project1
│ ├── project1.py
│ ├── _version.py
├── project2
│ ├── project2.py
│ ├── project2.spec
The problem is, Python always warns me about unresolved imports for local files. I thought setting "python.autoComplete.extraPaths": ["${relativeFileDirname}"]
would work but it doesn't. Is there an easier way so I don't have to add every single subfolder like this?
{
"python.autoComplete.extraPaths": [
"./project1",
"./project2"
]
}
It is recommended that you use the "Jedi" language service in VS Code: (in settings.json )
"python.languageServer": "Jedi",
and please use code:(in project1.py)
import _version
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.