2017-02-12 46 views
14

當我試圖使用命令virtualenv venv從終端用Python創建一個虛擬的環境中,我得到了以下錯誤:`使dyld:圖書館不是loaded`錯誤,導致的virtualenv加載

Using base prefix '/Users/zacharythomas/anaconda3' 
New python executable in /Users/zacharythomas/venv/bin/python 
dyld: Library not loaded: @rpath/libpython3.6m.dylib 
Referenced from: /Users/zacharythomas/venv/bin/python 
Reason: image not found 
ERROR: The executable /Users/zacharythomas/venv/bin/python is not functioning 
ERROR: It thinks sys.prefix is '/Users/zacharythomas' (should be '/Users/zacharythomas/venv') 
ERROR: virtualenv is not compatible with this system or executable 

我不是第一個人遇到類似的錯誤 - 我嘗試以下this answer's建議,並運行:

gfind ~/.virtualenvs/my-virtual-env/ -type l -xtype l -delete 

沒有幫助。也沒有運行sudo virtualenv venv作爲超級用戶運行commmand。

接下來應該調查什麼?

回答

38

我有完全相同的錯誤信息。雷·唐納利在連續Analytics(分析)支持小組提供了以下解決方案,它解決了這個問題對我來說:

When you pip installed virtualenvwrapper, pip will have installed virtualenv for you as it is a dependency. Unfortunately, that virtualenv is not compatible with Anaconda Python. Fortunately, the Anaconda Distribution has a virtualenv that is compatible. To fix this:

pip uninstall virtualenv 
conda install virtualenv 

can't get virtualenv to work with anaconda3 v4.3 on mac

+0

@ Dave2e明白了,謝謝你的指點,因爲我是新來的StackOverflow。事情發生的同時,我也遇到了這個問題的實際答案。所以,我編輯了我的原始非答案,並用此替換了它。 – user1764447