如何在sh scrip中执行python命令

2024-05-13 23:41:10 发布

您现在位置:Python中文网/ 问答频道 /正文

在FreeNAS中,我试图在/urllib3目录中执行以下命令

python setup.py install

在一个监狱里。你知道吗

如果我进监狱

iocage console jailname

然后键入命令

cd /urllib3

python setup.py install

它起作用了。我不知道如何在sh脚本中编写这个。你知道吗

当我在监狱外运行命令作为测试以包含在脚本中时

iocage exec jailname "python setup.py install"

我得到了错误

python: can't open file 'setup.py': [Errno 2] No such file or directory. 

我也试过了

iocage exec jailname "/urllib3/python setup.py install"

这就是错误所在

/bin/sh: /urllib3/python: not found.iocage exec jailname python /urllib3/setup.py install

努力

iocage exec jailname "python /urllib3/setup.py install"

给出错误

Traceback (most recent call last):  File "/urllib3/setup.py", line 18, in <module> with codecs.open("README.rst", encoding="utf-8") as fp:  File "/usr/local/lib/python3.6/codecs.py", line 897, in open
file = builtins.open(filename, mode, buffering) FileNotFoundError: [Errno 2] No such file or directory: 'README.rst'

Tags: installpy命令脚本sh错误setupopen