Sli*_*up 5 python macos shell automator
我正在尝试在 macOS 10.12 上使用 Automator 来启动 Python 3 脚本。该脚本时,我用下面的命令终端运行它只是罚款:python3 my_script.py
。
Automator 具有使用 /bin/bash shell 的“运行 Shell 脚本”功能。shell 将使用以下命令运行脚本:python my_script.py
,但这似乎只适用于用 Python 2.7 编写的脚本。
我的脚本以 开头#!/usr/bin/env python3
,我认为它会将 shell 引导到正确的 python 解释器,但情况似乎并非如此。
作为一种解决方法,如果我插入 python 解释器的完整路径,我可以让脚本运行:/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
,但我认为这是次优的,因为如果/当我更新到 Python 3.6 时,这些命令可能不起作用。
有没有更好的方法来引导 /bin/bash shell 运行 Python3 脚本?
既然你有 shebang 行,你就可以这样做./my_script.py
,并且它应该与 Python 3 一起运行。
归档时间: |
|
查看次数: |
6135 次 |
最近记录: |