【问题标题】:Specify which version of Python runs in Automator?指定在 Automator 中运行的 Python 版本是什么?
【发布时间】:2013-12-28 14:19:01
【问题描述】:

在我的终端和 CodeRunner 中,我的 Python 更新为 2.7.6,但是当我在 OSX Automator 中运行 shell 脚本时,我发现它正在运行 2.7.2

如何像其他编译器一样将 Automator Python 更新到 2.7.6?

【问题讨论】:

  • 您是否偶然在 Automator 脚本中使用了#!/usr/bin/python?这将运行系统 Python,它是 Mt Lion 的 2.7.2。您需要将其指向 2.7.6 二进制文件的正确位置
  • 而不是#!/usr/bin/python,而是#!/path/to/2/7/6/python - 如果您使用的是Python.org 安装,则可能是/Library/Frameworks/Python.framework/Versions/2.7/bin/python 或类似的东西。您需要确定它对您的系统的确切用途。如果您可以从命令行运行python 并获得正确的版本,请输入which python,它会为您提供路径。

标签: python macos updates automator


【解决方案1】:

我无法明确指定它使用哪个 python。 因此,我使用以下命令在bash 环境中运行它:

$ your/python/path /path/to/your/python/script.py

并确保您的 Python 程序的第一行包含您希望使用的 Python 环境的路径。 例如:

#! /usr/local/bin/python

【讨论】:

    猜你喜欢
    • 2022-11-04
    • 2018-09-13
    • 1970-01-01
    • 1970-01-01
    • 2014-05-30
    • 1970-01-01
    • 2019-04-18
    • 2013-07-19
    • 1970-01-01
    相关资源
    最近更新 更多