代码之家  ›  专栏  ›  技术社区  ›  Seanny123 Andrew

将pyproject.toml添加到项目中会使pip intsall失败

  •  0
  • Seanny123 Andrew  · 技术社区  · 5 年前

    我正在使用 pyproject.toml 配置 black 然而当添加该文件时, pip3 install -e . --user 失败,出现以下错误:

        ERROR: Complete output from command /usr/bin/python3 -c 'import setuptools, tokenize;__file__='"'"'/home/sean/git/auto-md/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=:
        ERROR: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
           or: -c --help [cmd1 cmd2 ...]
           or: -c --help-commands
           or: -c cmd --help
    
        error: option --user not recognized
        ----------------------------------------
    ERROR: Command "/usr/bin/python3 -c 'import setuptools, tokenize;__file__='"'"'/home/sean/git/auto-md/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=" failed with error code 1 in /home/sean/git/auto-md/
    

    为什么会出现此错误,我该如何解决?

    1 回复  |  直到 5 年前
        1
  •  6
  •   Seanny123 Andrew    5 年前

    根据讨论 this GitHub issue ,要解决此问题,您需要运行 pip3 install -e . --user --no-use-pep517 .

    原因很复杂,但本质上是:

    1. 通过使用 pyproject.toml ,您正在指示 pip 你应该使用新的 pep517 安装过程。

    2. pep517 不支持 -e --user ,所以它失败了。

    3. 没有其他方法可以自动配置 black ,所以你被困住了 pyproject.toml --no-use-pep517 .