3

我正在尝试关注JupyterHub 的贡献文档,并且在运行时遇到错误pre-commit run

该错误与我的 python 版本有关。3.6即使所有东西都是用 Python 安装的,出于某种原因,它仍然存在3.7.3。这是运行命令的输出:

(.hub)  {~/jupyter/jupyterhub} (master %)$  pre-commit run
[INFO] Initializing environment for https://github.com/asottile/reorder_python_imports.
[INFO] Initializing environment for https://github.com/ambv/black.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Installing environment for https://github.com/asottile/reorder_python_imports.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: Command: ('/Users/nicholasbrady/jupyter/jupyterhub/.hub/bin/python3', '-mvirtualenv', '/Users/nicholasbrady/.cache/pre-commit/repo5hv9ofak/py_env-python3.6', '-p', 'python3.6')
Return code: 3
Expected return code: 0
Output: 
    The path python3.6 (from --python=python3.6) does not exist

Errors: (none)

Check the log at /Users/nicholasbrady/.cache/pre-commit/pre-commit.log

如果我检查日志,这就是它所说的:

(.hub)  {~/jupyter/jupyterhub} (master %)$  cat /Users/nicholasbrady/.cache/pre-commit/pre-commit.log
An unexpected error has occurred: CalledProcessError: Command: ('/Users/nicholasbrady/jupyter/jupyterhub/.hub/bin/python3', '-mvirtualenv', '/Users/nicholasbrady/.cache/pre-commit/repo5hv9ofak/py_env-python3.6', '-p', 'python3.6')
Return code: 3
Expected return code: 0
Output: 
    The path python3.6 (from --python=python3.6) does not exist

Errors: (none)

Traceback (most recent call last):
  File "/Users/nicholasbrady/jupyter/jupyterhub/.hub/lib/python3.7/site-packages/pre_commit/error_handler.py", line 46, in error_handler
    yield
  File "/Users/nicholasbrady/jupyter/jupyterhub/.hub/lib/python3.7/site-packages/pre_commit/main.py", line 316, in main
    return run(args.config, store, args)
  File "/Users/nicholasbrady/jupyter/jupyterhub/.hub/lib/python3.7/site-packages/pre_commit/commands/run.py", line 295, in run
    install_hook_envs(hooks, store)
  File "/Users/nicholasbrady/jupyter/jupyterhub/.hub/lib/python3.7/site-packages/pre_commit/repository.py", line 215, in install_hook_envs
    hook.install()
  File "/Users/nicholasbrady/jupyter/jupyterhub/.hub/lib/python3.7/site-packages/pre_commit/repository.py", line 93, in install
    self.prefix, self.language_version, self.additional_dependencies,
  File "/Users/nicholasbrady/jupyter/jupyterhub/.hub/lib/python3.7/site-packages/pre_commit/languages/python.py", line 168, in install_environment
    _make_venv(env_dir, python)
  File "/Users/nicholasbrady/jupyter/jupyterhub/.hub/lib/python3.7/site-packages/pre_commit/languages/python.py", line 180, in make_venv
    cmd_output(*cmd, env=env, cwd='/')
  File "/Users/nicholasbrady/jupyter/jupyterhub/.hub/lib/python3.7/site-packages/pre_commit/util.py", line 153, in cmd_output
    returncode, cmd, retcode, output=(stdout, stderr),
pre_commit.util.CalledProcessError: Command: ('/Users/nicholasbrady/jupyter/jupyterhub/.hub/bin/python3', '-mvirtualenv', '/Users/nicholasbrady/.cache/pre-commit/repo5hv9ofak/py_env-python3.6', '-p', 'python3.6')
Return code: 3
Expected return code: 0
Output: 
    The path python3.6 (from --python=python3.6) does not exist

Errors: (none)


我试图清除缓存,因为它看起来像是在引用我使用 python 3.6 时可能已经存在的缓存

(.hub)  {~/jupyter/jupyterhub} (master %)$  pre-commit clean
Cleaned /Users/nicholasbrady/.cache/pre-commit.

但它根本没有改变错误或日志。

有谁知道这是什么吗?如果没有,希望我能尽快弄清楚并在我这样做时添加答案...... :)

4

1 回答 1

5

该存储库的配置集language_version: python3.6,这就是它尝试使用 python3.6 的原因

我建议将其更改为language_version: python3或安装python3.6

于 2019-09-02T22:54:03.283 回答