我有一个.sh脚本,我打电话给source the_script.sh.定期打电话很好.但是,我试图通过我的python脚本调用它subprocess.Popen.
从Popen调用它,我在以下两个场景调用中遇到以下错误:
foo = subprocess.Popen("source the_script.sh")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 672, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1213, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
>>> foo = subprocess.Popen("source the_script.sh", shell = True)
>>> /bin/sh: source: not found
Run Code Online (Sandbox Code Playgroud)
是什么赋予了?为什么我不能从Popen中调用"source",当我可以在python之外?