簡體   English   中英

在Mac OS下為終端以外的應用程序更改Python路徑

[英]Changing Python path under Mac OS for applications other than the terminal

我有一個Python腳本,希望能夠在Finder或Quicksilver中運行最少。 不幸的是,任何不使用終端運行腳本的方法都找不到我的庫。

例如,跑步

do shell script "~/anaconda/bin/python -c 'import sys; print len(sys.path)'"

來自Applescript的值是13,但正在運行

~/anaconda/bin/python -c 'import sys; print len(sys.path)'

從終端上給出15。這使我認為.bash_profile可能不是修改我的Python路徑的最佳位置。 有沒有辦法對Python路徑進行更改,使其同時影響終端和其他所有內容? 如果是這樣,那是修改Python路徑的首選方法嗎?

這是我的設置的一些版本信息:

Python 2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin

您可以設置環境變量PYTHONPATH 現在,我不是Mac用戶,但是根據一些研究,我說您必須按以下說明修改~/.MacOSX/environment.plisthttps : //developer.apple.com/library/mac/documentation/ MacOSX的/概念/ BPRuntimeConfig /用品/ EnvironmentVars.html#// apple_ref / DOC / UID / 20002093-BCIJIJBH

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM