运行Python脚本的shell脚本

问题描述 投票:0回答:1

如何创建一个运行 python 脚本的 shell 脚本。 Python 文件名将保存在环境变量 $PYFILE 中。 我想知道如何编写一个运行python脚本的shell脚本,然后运行它。

python shell interpreter
1个回答
0
投票

您只需要在 shell 脚本中使用 python 命令即可。 shell 脚本的内容应如下所示:

#! /usr/bin/bash

python $PYFILE

注意:如果您的机器没有 bash,您可以尝试使用

#! /usr/bin/sh
代替。

© www.soinside.com 2019 - 2024. All rights reserved.