How to get virtualenv to work with fish shell? Ask Question

How to get virtualenv to work with fish shell? Ask Question

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?

ベストアンサー1

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

おすすめ記事