更改pip生成目录的名称

2024-09-27 00:20:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在Linux上使用PIP20.2.3将其他软件包(extras_require['test'])安装到一个首先使用python setup.py build -b _build构建的项目中。在项目的目录中,还有一个名为build的自定义脚本(我不应该更改它的名称)。当我运行pip install .[test]时,它会抱怨build已经存在并且失败:

$ echo $TMPDIR
/.local/work/.ab/
$ pip install .[test]
[...]
  ERROR: Command errored out with exit status 1:
   command: /[...]/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/.local/work/.ab/pip-req-build-qxn943bk/setup.py'"'"'; __file__='"'"'/.local/work/.ab/pip-req-build-qxn943bk/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /.local/work/.dv/pip-wheel-yhzxeqaj
       cwd: /.local/work/.ab/pip-req-build-qxn943bk/
  Complete output (5 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  error: could not create 'build': File exists
  ----------------------------------------
  ERROR: Failed building wheel for xxx

我已经尝试将--build传递给pip,但该选项在手册页中被标记为不推荐,显然被忽略

有没有其他方法可以让pip使用另一个名称作为其构建目录(例如_build),或者有没有方法使用python setup.py build -b _build只安装extras_require['test']


Tags: pippytestbuildextrasablocalsetup

热门问题