我有一个helper
在主 python 文件目录中命名的模块,但是即使 python3 完美运行它,pylance 也会发出警告Import "helper" could not be resolved
,如何解决这个问题?
helper 是一个目录
目录结构:
main.py
helper/
└── __init__.py
主要.py:
import helper
helper.run()
我有一个helper
在主 python 文件目录中命名的模块,但是即使 python3 完美运行它,pylance 也会发出警告Import "helper" could not be resolved
,如何解决这个问题?
helper 是一个目录
目录结构:
main.py
helper/
└── __init__.py
主要.py:
import helper
helper.run()
尝试添加
"python.analysis.extraPaths": ["./helper"]
到您的 .vscode/settings.json 文件,如此处所述https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#unresolved-import-warnings
我不知道为什么,但它现在可以工作了,谢谢你的帮助!