Proper relative imports: “Unable to import module”

前端 未结 4 1728
南方客
南方客 2021-02-12 11:34

I have a project structured like this:

.
└── myapp
    ├── app.py
    ├── models
    │   ├── hello.py
    │   └── world.py
    └── requirements.txt
4条回答
  •  感动是毒
    2021-02-12 12:06

    The error you are receiving is one that's reported by a python linter named pylint. So the problem isn't really specific to the vscode extension.

    There are two solutions:

    1. Please try adding an .env file in your project directory with the vape PYTHONPATH=./myapp, this will tell pylint where to find your modules

    2. Or just open the folder myapp in vscode directly instead of opening the parent directory in vscode.

提交回复
热议问题