当我知道文件存在时导入时出现 E0611 错误

E0611 error on import when I know the file exists

使用 pylint,当我知道文件存在且脚本运行正常时,我在导入时遇到 E0611 错误。建议?我用错误注释了下面的图片。

试试这个: 在 VS 代码首选项 > 设置中,将 "python.linting.pylintPath" 更改为虚拟环境路径“/bin/pylint” https://github.com/Microsoft/vscode-docs/blob/master/docs/python/linting.md

使用命令 git clean -dfx 删除所有忽略的文件(在 __pycache__ 文件夹等中)解决了我的问题。 (警告:确保在执行此命令之前没有任何要保留的重要 git-ignored 文件。)