Fish shell is friendlier yet you might face trouble while using with virtualenv
or virtualenvwrapper
. Alternatively virtualfish
exists for the rescue. Just follow the below sequence to start using Fish shell with virtualenv.
Install virtualfish to the global space
sudo pip install virtualfish
Load the python module virtualfish during the fish shell startup
$ echo "eval (python -m virtualfish)" > ~/.config/fish/config.fish
Edit this function fish_prompt
by $ funced fish_prompt --editor vim
and add the below lines and close the vim editor
if set -q VIRTUAL_ENV
echo -n -s (set_color -b blue white) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal) " "
end
Note: If you are unfamiliar with vim, simply supply your favorite editor like this $ funced fish_prompt --editor nano
or $ funced fish_prompt --editor gedit
Save changes using funcsave
funcsave fish_prompt
To create a new virtual environment use vf new
vf new my_new_env # Make sure $HOME/.virtualenv exists
If you want create a new python3 environment specify it via -p
flag
vf new -p python3 my_new_env
To switch between virtualenvironments use vf deactivate
& vf activate another_env
Official Links: