【问题标题】:How can i correct linting python import when use zc.buildout in vscode在 vscode 中使用 zc.buildout 时如何更正 linting python 导入
【发布时间】:2018-02-23 10:30:03
【问题描述】:

我创建了一个 python django 项目使用 zc.buildout 但在 vscode pylint 中无法识别鸡蛋中的导入。

错误:

[pylint] E0401:无法导入“django.test”

【问题讨论】:

  • Pylint 能否识别 VS Code 之外的导入?
  • 这是因为在使用zc.buildout时,它会创建一个./bin/python脚本作为项目的解释器,并将./eggs模块添加到python路径中。但是如果我设置了 vscode 解释器的./bin/python,那么 pylint 就不起作用了。我不知道如何配置 vscode...

标签: python visual-studio-code pylint buildout


【解决方案1】:

您可以使用 .env 文件操作您的 PYTHONPATH 环境变量,该文件将在运行 Pylint 时使用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多