我的程序的基本结构如下所示:
top_dir
__init__.py
readme.rst
sub_dir
__init__.py
sub_sub_dir
__init__.py
example_module.py
sub_sub_dir2
__init__.py
module_with_import.py
Run Code Online (Sandbox Code Playgroud)
在Pycharm中,所有导入都可以正常工作.例如,我在'module_with_import.py'中使用以下导入:
from sub_dir.sub_sub_dir.example_module import function
Run Code Online (Sandbox Code Playgroud)
但是,如果我在module_with_import.py上运行pylint,我将收到以下错误:
Unable to import 'sub_dir.sub_sub_dir.example_module' (import-error)
Run Code Online (Sandbox Code Playgroud)
有人看到这里有什么问题吗?