0

我有一个helper在主 python 文件目录中命名的模块,但是即使 python3 完美运行它,pylance 也会发出警告Import "helper" could not be resolved,如何解决这个问题?
helper 是一个目录

目录结构:

main.py
helper/
└── __init__.py

主要.py:

import helper
helper.run()
4

2 回答 2

0

尝试添加

  "python.analysis.extraPaths": ["./helper"]

到您的 .vscode/settings.json 文件,如此处所述https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#unresolved-import-warnings

于 2021-07-02T19:25:41.920 回答
0

我不知道为什么,但它现在可以工作了,谢谢你的帮助!

于 2021-07-11T01:21:11.457 回答