Skip to content
Advertisement

Why I have to “source vitrualenvwrapper.sh” every time I open a new Terminal?

I use Zsh as my shell and I want to use vitrualenvwrapper. But when I close a terminal then open a new one, I have to “source virtualenvwrapper.sh” again then I can use virtualenvwrapper.

# koen @ Evan in ~ [10:59:12] 
$ lsvirtualenv
zsh: command not found: lsvirtualenv

# koen @ Evan in ~ [10:59:31] C:127
$ source /usr/local/bin/virtualenvwrapper.sh 

# koen @ Evan in ~ [10:59:55] 
$ lsvirtualenv                              
Flask_env
=========


hello_env
=========



# koen @ Evan in ~ [11:00:08] 
$ 

Advertisement

Answer

You need to put your script source-ing in some shell session initialization file e.g. /etc/zsh/zshrc (global) or ~/.zshrc (user-specific) will be read by zsh upon starting of an interactive session, with the latter one taking precedence over the former.

So, in your case, you can simple put the source-ing in ~/.zshrc so that it would be read by zsh upon starting of the interactive session:

echo 'source /usr/local/bin/virtualenvwrapper.sh' >>~/.zshrc
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement