2017-02-12 43 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