`dyld: Library not loaded` 错误阻止 virtualenv 加载

`dyld: Library not loaded` error preventing virtualenv from loading

当我尝试使用终端中的命令 virtualenv venv 使用 python 创建虚拟环境时,出现以下错误:

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 建议和 运行ning:

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

这没有帮助。 运行ning sudo virtualenv venv to 运行 也没有以超级用户的身份发出命令。

接下来我应该调查什么?

我收到了完全相同的错误消息。 Continuum Analytics Support Group 的 Ray Donnelly 提供了以下解决方案,为我解决了这个问题:

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