gpt4 book ai didi

python - 跟踪 python : only include some files

转载 作者:太空狗 更新时间:2023-10-29 17:15:41 28 4
gpt4 key购买 nike

我知道我可以使用它来跟踪命令执行:

python -m trace -t script.py

但我想减少输出:只应显示我的 src/(pip install -e ...) 中的文件。

我该怎么做?

最佳答案

如果您从 bash 运行脚本,您可以使用如下内容:

python -m trace --ignore-dir=$(python -c 'import sys ; print ":".join(sys.path)[1:]') -t ./script.py

对于 python3:

python -m trace --ignore-dir=$(python -c 'import sys ; print(":".join(sys.path)[1:])') -t ./script.py

这样你就可以忽略你是否处于虚拟环境或更深奥的场景中。

关于python - 跟踪 python : only include some files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25667124/

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