Using virtualenv with fish shell
suggest changeFish 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_promptby$ funced fish_prompt --editor vimand 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
-pflag
vf new -p python3 my_new_env
- To switch between virtualenvironments use
vf deactivate&vf activate another_env
Official Links:
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents