0

因为获得这个简单的信息是一项艰巨的任务,所以我决定将其发布给其他人:

  1. 在终端执行: mkdir ~/.MacOSX
  2. 在终端执行:touch ~/.MacOSX/environment.plist
  3. 浏览到文件并打开。
  4. 粘贴:

        <key>DISPLAY</key>
    
        <string>:0.0</string>
    
        <key>PYTHONPATH</key>
    
        <string>/full/path/ofyour/favorite/script/dir:/full/path/of/another/script/dir:
    

  5. 编辑您需要的内容并保存。

4

2 回答 2

2

这是使用Property List Editor进行记录的方法。

请注意,以这种方式设置环境变量时应该小心,因为它们适用于启动的 GUI 应用程序,而这些应用程序可能不期望它们。对于在终端 shell 中工作时设置默认环境变量,使用 shell 配置文件命令的传统 UNIX 方式(如.profileor .bash_profile)是首选且不太可能破坏事物。

于 2011-01-21T18:16:24.530 回答
1
  1. 在终端执行:mkdir ~/.MacOSX
  2. 在终端执行:touch ~/.MacOSX/environment.plist
  3. 浏览到文件并打开。
  4. 粘贴:

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>DISPLAY</key>
    <string>:0.0</string>
    <key>PYTHONPATH</key>
    <string>/full/path/ofyour/favorite/script/dir:/full/path/of/another/script/dir:</string>
  </dict>
</plist>

编辑您需要的内容并保存。

(这是原发帖人写的,作为问题的一部分。因为不是我写的,所以重新发布为社区 wiki,只是清理了格式。)

于 2011-01-21T10:47:37.613 回答