首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何让皮林特和黑人在VSCode一起工作?

如何让皮林特和黑人在VSCode一起工作?
EN

Stack Overflow用户
提问于 2018-11-04 17:30:58
回答 2查看 6.2K关注 0票数 1

我一直试图让皮林特和黑衣人在VSCode上一起工作,但没有成功。

我可以让其中一个工作,但只有在另一个不能工作的情况下(即黑色将格式化,但没有任何报告将由pylint,或pylint将报告错误,但运行‘格式代码’什么也不做)。

这是我的setttings.json:

代码语言:javascript
复制
{
    "editor.formatOnSave": true,
    "editor.formatOnPaste": false,
    "editor.formatOnType": false,
    "python.pythonPath": "/usr/bin/python3",
    "python.linting.pylintEnabled": true,
    "python.linting.pylintPath": "/usr/bin/pylint-3",
    "python.linting.flake8Enabled": false,
    "python.linting.flake8Path": "/usr/bin/flake8-3",
    "python.formatting.provider": "black",
    "python.formatting.blackPath": "/usr/bin/black",
    "python.formatting.blackArgs": [
        "--line-length=110"
    ],
    "python.unitTest.pyTestEnabled": true,
    "workbench.colorTheme": "Default Light+",
    "workbench.settings.editor": "json",
    "python.linting.enabled": true
}

环境:

  • 软呢帽29
  • VSCode 1.28.2
  • Python扩展插件2018.9.2
  • 吡啶2.1.1
  • 黑色18.6b4
EN

回答 2

Stack Overflow用户

发布于 2019-05-17 21:34:35

我试过这个还没成功。如果我的记忆是对的,flake8 + autopep8也是如此。现在,由于一些依赖冲突,我甚至无法将它们安装在同一个pipenv虚拟环境中。如果您感兴趣,可以检查下面的输出。

目前,我使用pylint+autopep8 (默认VS代码),如果您想继续使用black,我想您需要将链接器切换到其他地方。

代码语言:javascript
复制
// I have pylint installed already
➜ pipenv install --dev autopep8 
Installing autopep8…
Adding autopep8 to Pipfile's [dev-packages]…
✔ Installation Succeeded 
Pipfile.lock (3830f9) out of date, updating to (6cacd5)…
Locking [dev-packages] dependencies…
✘ Locking Failed! 
[pipenv.exceptions.ResolutionFailure]:   File "/home/xzhan/miniconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 69, in resolve
[pipenv.exceptions.ResolutionFailure]:       req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]:   File "/home/xzhan/miniconda3/lib/python3.7/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]:   File "/home/xzhan/miniconda3/lib/python3.7/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]:   File "/home/xzhan/miniconda3/lib/python3.7/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches black
[pipenv.exceptions.ResolutionFailure]:       Skipped pre-versions: 18.3a0, 18.3a0, 18.3a1, 18.3a1, 18.3a2, 18.3a2, 18.3a3, 18.3a3, 18.3a4, 18.3a4, 18.4a0, 18.4a0, 18.4a1, 18.4a1, 18.4a2, 18.4a2, 18.4a3, 18.4a3, 18.4a4, 18.4a4, 18.5b0, 18.5b0, 18.5b1, 18.5b1, 18.6b0, 18.6b0, 18.6b1, 18.6b1, 18.6b2, 18.6b2, 18.6b3, 18.6b3, 18.6b4, 18.6b4, 18.9b0, 18.9b0, 19.3b0, 19.3b0
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches black
Skipped pre-versions: 18.3a0, 18.3a0, 18.3a1, 18.3a1, 18.3a2, 18.3a2, 18.3a3, 18.3a3, 18.3a4, 18.3a4, 18.4a0, 18.4a0, 18.4a1, 18.4a1, 18.4a2, 18.4a2, 18.4a3, 18.4a3, 18.4a4, 18.4a4, 18.5b0, 18.5b0, 18.5b1, 18.5b1, 18.6b0, 18.6b0, 18.6b1, 18.6b1, 18.6b2, 18.6b2, 18.6b3, 18.6b3, 18.6b4, 18.6b4, 18.9b0, 18.9b0, 19.3b0, 19.3b0
There are incompatible versions in the resolved dependencies.
[pipenv.exceptions.ResolutionFailure]:       req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]:   File "/home/xzhan/miniconda3/lib/python3.7/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]:   File "/home/xzhan/miniconda3/lib/python3.7/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]:   File "/home/xzhan/miniconda3/lib/python3.7/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches black
[pipenv.exceptions.ResolutionFailure]:       Skipped pre-versions: 18.3a0, 18.3a0, 18.3a1, 18.3a1, 18.3a2, 18.3a2, 18.3a3, 18.3a3, 18.3a4, 18.3a4, 18.4a0, 18.4a0, 18.4a1, 18.4a1, 18.4a2, 18.4a2, 18.4a3, 18.4a3, 18.4a4, 18.4a4, 18.5b0, 18.5b0, 18.5b1, 18.5b1, 18.6b0, 18.6b0, 18.6b1, 18.6b1, 18.6b2, 18.6b2, 18.6b3, 18.6b3, 18.6b4, 18.6b4, 18.9b0, 18.9b0, 19.3b0, 19.3b0
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches black
Skipped pre-versions: 18.3a0, 18.3a0, 18.3a1, 18.3a1, 18.3a2, 18.3a2, 18.3a3, 18.3a3, 18.3a4, 18.3a4, 18.4a0, 18.4a0, 18.4a1, 18.4a1, 18.4a2, 18.4a2, 18.4a3, 18.4a3, 18.4a4, 18.4a4, 18.5b0, 18.5b0, 18.5b1, 18.5b1, 18.6b0, 18.6b0, 18.6b1, 18.6b1, 18.6b2, 18.6b2, 18.6b3, 18.6b3, 18.6b4, 18.6b4, 18.9b0, 18.9b0, 19.3b0, 19.3b0
There are incompatible versions in the resolved dependencies.
票数 0
EN

Stack Overflow用户

发布于 2020-06-25 07:23:39

这对我来说很管用:

我认为秘密酱汁的一部分是禁用某些与黑色冲突的皮林特警告(“禁用=.”)

在根目录中添加文件.pylintrc:

代码语言:javascript
复制
# Looks like setup.cfg cannot load the extensions in the precommit,
# but that the pylintrc file can
# This happens even when specifying --rcfile=setup.cfg
# Possible bug from pylint?
[MASTER]
load-plugins = pylint.extensions.docparams, pylint.extensions.docstyle, pylint.extensions.mccabe

[BASIC]
accept-no-param-doc = no
accept-no-raise-doc = no
accept-no-return-doc = no
accept-no-yields-doc = no
default-docstring-type = numpy

[FORMAT]
max-line-length = 88

[MESSAGES CONTROL]
disable = C0330, C0326, C0199, C0411
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53143505

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档