【发布时间】:2016-05-03 11:59:03
【问题描述】:
在使用pip 安装依赖项时,是否可以使用tox 避免将输出重定向到文件?我想看看正在安装什么,所以我想登录到标准输出而不是文件。
【问题讨论】:
在使用pip 安装依赖项时,是否可以使用tox 避免将输出重定向到文件?我想看看正在安装什么,所以我想登录到标准输出而不是文件。
【问题讨论】:
如果您想查看每次运行都安装了什么,使用pip freeze 怎么样?您可以将其添加到 commands 部分,它将以需求格式转储已安装的软件包。
commands =
pip freeze
... rest of your commands here.
我经常使用这种策略来执行类似python echo_versions.py 之类的操作,其中echo_versions.py 是一个小脚本,它显示每次运行我感兴趣的包的版本 - 只是为了确保安装了预期的包。
【讨论】:
我通过在tox.ini 中添加更改install_command 来解决,如下所示:
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
【讨论】: