简体   繁体   English

为 tox 指定自定义 `virtualenv` 命令

[英]Specify custom `virtualenv` command for tox

Is there a way to specify the location of the virtualenv executable for tox to use?有没有办法指定tox使用的virtualenv可执行文件的位置?

Here is the problem:这是问题所在:

The company I work for uses its own patched python with its own virtualenv .我工作的公司使用自己的打补丁 python 和自己的virtualenv That virtualenv executable is very old, and it cannot be used to install the dependencies needed for the project, so when the project is initialized and the virtual environment for that project is created, the virtualenv executable in that environment gets updated to a later version.该 virtualenv 可执行文件非常旧,不能用于安装项目所需的依赖项,因此当项目初始化并创建该项目的虚拟环境时,该环境中的virtualenv可执行文件会更新到更高版本。 When I activate that environment and try to run tox in it, tox uses that environment's virtualenv executable to create its own (that is, tox's) virtual environments.当我激活该环境并尝试在其中运行 tox 时,tox 使用该环境的 virtualenv 可执行文件来创建它自己的(即 tox 的)虚拟环境。 However, that updated virtualenv executable cannot create a correctly configured virtual environment for that patched python.但是,更新后的 virtualenv 可执行文件无法为已修补的 python 创建正确配置的虚拟环境。 To do that, I need to be able to call the initial 'old' patched virtualenv executable, and thus I need to be able to tell tox where to look for it.为此,我需要能够调用最初的“旧”修补 virtualenv 可执行文件,因此我需要能够告诉 tox 在哪里寻找它。

Hope this explanation is not too convoluted.希望这个解释不要太复杂。

Your only real option is to create a tox plugin that uses the patched virtualenv - seehttps://github.com/tox-dev/tox/blob/master/src/tox/venv.py#L698 and https://tox.readthedocs.io/en/latest/plugins.html#creating-a-plugin您唯一真正的选择是创建一个使用修补的 virtualenv 的 tox 插件 - 请参阅https://github.com/tox-dev/tox/blob/master/src/tox/venv.py#L698https://tox .readthedocs.io/en/latest/plugins.html#creating-a-plugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM