3

安装依赖项时是否tox可以避免将输出重定向到文件pip?我想看看正在安装什么,所以我想登录到标准输出而不是文件。

4

2 回答 2

2

如果您想查看每次运行都安装了什么,那么使用pip freeze呢?您可以将其添加到该commands部分,它将以需求格式转储已安装的软件包。

commands =
    pip freeze
    ... rest of your commands here.

我经常使用这种策略来执行类似python echo_versions.pywhere echo_versions.pyis a small script,它显示每次运行时我感兴趣的包的版本 - 只是为了确保安装了预期的包。

于 2016-05-29T08:47:26.763 回答
1

我通过添加以下更改来install_command解决tox.ini

install_command = ./install_deps {opts} {packages}

哪里install_deps是:

#!/bin/sh
# This script is used as `install_command` for `tox` in order to log to stdout
# the requirements that are being installed.

pip install $@ | tee /dev/tty
于 2016-06-03T09:16:40.703 回答