gpt4 book ai didi

python - 如何获取结构命令来更新输出?

转载 作者:太空宇宙 更新时间:2023-11-03 21:19:08 24 4
gpt4 key购买 nike

Pipenv 就地更新命令行输出。 Fabric 1.14.0 将每次更新视为新行。这会导致大量多余的输出。

我已阅读运行操作的文档。尝试将 capture_buffer_size 设置为 100。没有什么区别。

def install_packages():
"Install packages on the remote host."""
with cd('/data/repo/'):
run("pipenv install", capture_buffer_size=100)

实际结果:

[server] run: pipenv install [server] out: Creating a virtualenv for this project…
[server] out: Pipfile: /data/repo/Pipfile
[server] out: Using /usr/bin/python3.5 (3.5.2) to create virtualenv…
[server] out:
[server] out: ⠋ Creating virtual environment... [server] out: ⠙ Creating virtual environment...
[server] out: ⠹ Creating virtual environment...
[server] out: ⠸ Creating virtual environment...

......

[server] out: ✔ Successfully created virtual environment!

预期结果:

[server] run: pipenv install
[server] out: Creating a virtualenv for this project…
[server] out: Pipfile: /data/repo/Pipfile
[server] out: Using /usr/bin/python3.5 (3.5.2) to create virtualenv…
[server] out:
[server] out: ⠋ Creating virtual environment...
[server] out: ✔ Successfully created virtual environment!

最佳答案

run("pipenv install") 指令包装在 with hide('output') 上下文管理器中。删除 capture_buffer_size kwarg。

有关调整输出的更多信息,请参阅 here

关于python - 如何获取结构命令来更新输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54439002/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com