2014-02-12 76 views
2

如何將我的mac上的python設置回默認參考位置?當我做Mac默認Python

sudo easy_install virtualenv 

我得到下面的結果

dyld: Library not loaded: @rpath/Python 
    Referenced from: /Users/a1ctesta/Library/Enthought/Canopy_64bit/User/bin/python 
    Reason: image not found 

我沒有雨棚安裝任何更長,所以我想挽回這段回到那個附帶的計算機上的原件備查。

回答

4

您可能需要修改您的$PATH環境變量,以便/usr/bin位於您的自定義路徑之前。要檢查是否這是問題,運行下面的命令,看是否/usr/bin之前或自定義的路徑

$ echo $PATH 

環境變量通常被設置在~/.bash_profile,例如我的系統上我有

路徑之後
export PATH=/opt/local/bin:/opt/local/sbin:/Developer/usr/bin:$PATH 

這意味着/opt/local/bin中的python可執行文件優先於默認PATH中的可執行文件。

+0

我確定這可以爲其他人工作,但它並不適用於我;但是,這確實導出PATH =/usr/bin:$ PATH – AshHimself

2

確保

在/ usr/bin中

/用戶/ a1ctesta /庫/ Enthought/Canopy_64bit /用戶/斌/ Python的

要這樣做:

  1. 在終端中,

    出口PATH =/USR/bin中:/用戶/ a1ctesta /庫/ Enthought/Canopy_64bit /用戶/ bin中/蟒

  2. 驗證此使用,

    回聲$ PATH

1

我也有這個問題。如果你編輯你的〜/ .bash_profile它將永久解決這個問題。

在終端輸入

nano ~/.bash_profile 

然後它會顯示出沿

# Setting PATH for Python 2.7 
# The orginal version is saved in .bash_profile.pysave 
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" 
export PATH 


# Added by Canopy installer on 2017-03-28 
# VIRTUAL_ENV_DISABLE_PROMPT can be set to '' to make the bash prompt show that Canopy is active, otherwise 1 
alias activate_canopy="source '/Users/chrisdunstan/Library/Enthought/Canopy_64bit/User/bin/activate'" 
VIRTUAL_ENV_DISABLE_PROMPT=1 source '/Users/chrisdunstan/Library/Enthought/Canopy_64bit/User/bin/activate' 

刪除一切由雨棚安裝程序,然後按^ o添加保存的線,然後事^ X關閉。重新啓動終端,它應該使用內置的python編譯器。

我發現的另一個解決方案是重新安裝Canopy,然後轉到Preferences並取消選擇Canopy作爲默認的python編譯器。