【发布时间】:2016-01-11 13:56:01
【问题描述】:
我正在尝试从 Python 脚本(Python 2.7、Ubuntu 14.04)中编写 requirements.txt 文件。按照here的建议我试过了
import subprocess
with open("requirements.txt", "w") as f:
subprocess.call(["pip freeze"], stdout=f)
但由于某种原因,我不知道我收到了错误:
OSError: [Errno 2] No such file or directory
运行脚本的文件夹是可写的。什么会导致这个问题?
【问题讨论】:
标签: python python-2.7 subprocess pip