问题描述
我以前在使用 virtualenvwrapper 时从未看到此消息,但现在我突然在运行时看到此消息,例如 mkvirtualenv <environment> 或 workon <environment>:
I never used to see this message before when using virtualenvwrapper, but now I'm suddenly seeing this message whenever I run, say, mkvirtualenv <environment> or workon <environment>:
Usage: source deactivate removes the 'bin' directory of the environment activated with 'source activate' from PATH.
我根本没有修改 virtualenvwrapper,快速谷歌搜索只会产生 这个 GitHub 问题——我确实安装了 IPython/Anaconda,但我不确定它会如何干扰 virtualenvwrapper.在任何情况下,我都尝试更新(conda update conda; conda update ipython),以及将 virtualenvwrapper 本身更新到 v4.1.1,但我仍然看到这个错误.
I haven't modified virtualenvwrapper at all, and a quick google search only yields this GitHub issue -- I did install IPython/Anaconda a while back, but I'm not sure how it might be interfering with virtualenvwrapper. In any case, I tried updating both (conda update conda; conda update ipython), as well as updating virtualenvwrapper itself to v4.1.1, but I'm still seeing this error.
我正在运行 OS X 10.8.4.
I'm running OS X 10.8.4.
推荐答案
workon,定义在/usr/local/bin/virtualenvwrapper.sh,调用<代码>停用代码>.Anaconda 的 bin 中存在同名脚本,因此它会被 workon 调用.
workon, which is defined in /usr/local/bin/virtualenvwrapper.sh, calls deactivate. A script of the same name is present in Anaconda's bin, so it gets called by workon.
到目前为止,我发现的最佳解决方案是在 Anaconda 的 bin 中重命名 activate 和 deactivate.如果有更好的解决方案,请发表评论,我会更新这个答案.
The best solution I've found so far is to rename activate and deactivate in Anaconda's bin. If there's a better solution, please comment and I'll update this answer.