How to get virtualenv to work with fish shell

drbunsen picture drbunsen · Jun 8, 2012 · Viewed 31.2k times · Source

I'm trying to get virtualenv to work with the fish shell. I have virtualenv installed and it works fine with bash and zsh. However, running the following command returns fish: Unknown command 'source':

$ source ~/path/to/bin/activate

Does anyone know how to get virtualenv and the fish shell to work together. Thanks in advance.

Answer

user146416 picture user146416 · Jun 9, 2012

You don't need to activate to use virtualenv it is a convenience. You can just use the virtualenv directly:

virtualenv venv
./venv/bin/pip install foo

Have you tried from fish using:

. venv/bin/activate.fish

It probably isn't as widely used as bash so may have issues - looking at the commit history shows a recent fix:

https://github.com/pypa/virtualenv/blob/master/virtualenv_embedded/activate.fish