【问题标题】:Pylinter in Sublime text 3.1.1 still doesn't use Python2.7Sublime text 3.1.1 中的 Pylinter 仍然不使用 Python2.7
【发布时间】:2019-04-24 05:08:45
【问题描述】:

这是我的 pylinter 设置:

    {
        // When versbose is 'true', various messages will be written to the console.
        // values: true or false
        "verbose": false,
        // The full path to the Python executable you want to
        // run Pylint with or simply use 'python'.
        "python_bin": "/usr/bin/python2.7",
        // The following paths will be added Pylint's Python path
        "python_path": [],
        // Optionally set the working directory
        "working_dir": null,
        // Full path to the lint.py module in the pylint package
        "pylint_path": null,
        // Optional full path to a Pylint configuration file
        "pylint_rc": null,
        // Set to true to automtically run Pylint on save
        "run_on_save": true,
        // Set to true to use graphical error icons
        "use_icons": false,
        "disable_outline": false,
        // Status messages stay as long as cursor is on an error line
        "message_stay": false,
        // Ignore Pylint error types. Possible values:
        // "R" : Refactor for a "good practice" metric violation
        // "C" : Convention for coding standard violation
        // "W" : Warning for stylistic problems, or minor programming issues
        // "E" : Error for important programming issues (i.e. most probably bug)
        // "F" : Fatal for errors which prevented further processing
        "ignore": [],
        // a list of strings of individual errors to disable, ex: ["C0301"]
        "disable": [],
        "plugins": []
    }

我已经清楚地将 python2.7 可执行文件放在了正确的位置(我认为)。这是which python2.7给我的路径。 然而,像 print "test" 这样的语句仍然返回 E0001 Missing parentheses in call to print - 一个经典的 python3 vs 2 错误。

如何让它检查 python2.7 错误?

【问题讨论】:

  • 这确实是一个有趣的问题。通过查看插件代码,如果 pylint 在您的路径上可用,那么 python_bin 完全不做任何事情(例如,您可以将其设置为无意义的,但仍然可以正常使用 lint)。我发现很多轶事证据表明他们计划放弃对 Python 2 的支持,但我不知道这是否意味着通过 Python 2 运行它或检查 Python 2 代码。
  • 我为 python2.7 找到了一些东西:stackoverflow.com/questions/51746255/… 但是是的,看起来他们将在今年年初停止支持 Python 2。

标签: python sublimetext3 pylint


【解决方案1】:

您是否尝试按照文档中的建议设置“可执行文件”? http://www.sublimelinter.com/en/stable/linter_settings.html#executable

我的配置中的 sn-p (Windows):

"executable": "C:\\Python27\\Scripts\\pylint.exe"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-14
    • 1970-01-01
    • 1970-01-01
    • 2014-01-26
    • 2015-02-17
    • 2019-05-16
    • 1970-01-01
    相关资源
    最近更新 更多