Why I am suddenly seeing `Usage: source deactivate` whenever I run virtualenvwrapper commands?

醉酒当歌 提交于 2019-11-30 08:12:55

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.

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.

This happened to me after installing Anaconda from https://www.continuum.io/downloads. If you don't need the program and it will be uninstalled, remove the following from your ~/.bash_profile:

added by Anaconda2 4.2.0 installer
export PATH="//anaconda/bin:$PATH"

Anaconda already knows where activate and the different environments are so virtualenvwrapper isn't needed.

All virtualenvwrapper seems to provide on Mac is the workon shortcut to source activate, you can use an alias in your bash.rc file and uninstall virtualenvwrapper.

Just add the alias line below where you add ~/anaconda/bin to your path like the example below.

# added by Anaconda3 4.3.1 installer
export PATH="$HOME/anaconda/bin:$PATH"

# Add workon alias here!
alias workon='source activate'

Now when I run 'workon Django', it runs my Anaconda Django virtual env without reminding me that 'source deactivate' is the way to exit.

If you didn't catch that, to exit the virtual env just run 'source deactivate'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!