系统环境是在Mac OS小牛的AppleScript编辑和运行我的脚本独立之间的不同 [英] System environment is different between AppleScript editor and running my script standalone under Mac OS Mavericks

查看:414
本文介绍了系统环境是在Mac OS小牛的AppleScript编辑和运行我的脚本独立之间的不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有上堆栈溢出的大量信息关于如何设置环境变量(如这个问题这个)。不幸的是,似乎苹果一直玩这个过程中有很多在过去的几年里和这么多的讨论似乎线上由山狮和小牛队已经过时。还有在最近的帖子讨论的两种方法:编辑的launchd。 CONF 并修改〜/ .MacOSX / environment.plist 。我都试过,现在还在到处都没有让我的新的环境变量我想要的。

There is a lot of information on Stack Overflow about how to set environment variables (like this question and this one). Unfortunately it seems that Apple has been playing with this process a lot over the last few years and so much of the discussion online seems to have been rendered obsolete by Mountain Lion and Mavericks. There are two methods discussed in more recent posts: editing launchd.conf and modifying ~/.MacOSX/environment.plist. I've tried both and am still not getting my new environment variable everywhere I want.

我已经煮问题到该位的AppleScript的:

I've boiled the problem down to this bit of AppleScript:

set pp to system attribute "PYTHONPATH"
display dialog pp buttons {"OK"} default button 1

当我从AppleScript的编辑器中运行的code它给了我一个非空的PYTHONPATH,这正是我想要的(<一个href=\"http://stackoverflow.com/questions/21971324/changing-python-path-under-mac-os-for-applications-other-than-the-terminal\">I'm尝试设置PYTHONPATH变量脚本从其他地方跑的比终端窗口的)。但是,当我运行水银相同的脚本(这是真的,我想它的工作),它给了我一个空的Python路径。我的方式,将显示这两个地方设置PYTHONPATH?

When I run the code from the AppleScript editor it gives me a non-empty PYTHONPATH, which is what I want (I'm trying to set the PYTHONPATH variable for scripts run from places other than terminal windows). But when I run the same script from Quicksilver (which is really where I'd like it to work), it gives me an empty Python path. Can I set PYTHONPATH in a way that will show up both places?

推荐答案

答案是编辑launchd.conf的以及然后重新启动。 这个答案声称要告诉你如何做到这一点不重新启动,但它并没有为我工作。

The answer was to edit launchd.conf and then restart. This answer claims to tell you how to do it without a restart, but it didn't work for me.

答案是约塞米蒂不同。看到这两个网页:

The answer is different under Yosemite. See these two pages:


  1. http://apple.stackexchange.com/a/106814/60655

  2. 约塞米蒂launchd.conf的不再起作用?

  1. http://apple.stackexchange.com/a/106814/60655
  2. Yosemite launchd.conf no longer work?

这篇关于系统环境是在Mac OS小牛的AppleScript编辑和运行我的脚本独立之间的不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆