Search code examples
pythonpython-3.xfishpython-venv

How to deactivate venv while using fish?


I have installed venv using python3 with fish like and activated using env/bin/activate.fish, but there is no deactivate.fish in env/bin/

➜ ls env/bin/
activate         activate.fish    easy_install     pip              pip3.7           python3
activate.csh     chardetect       easy_install-3.7 pip3             python           yapf

how can I deactivate venv?


Solution

  • In opposite to activate, deactivate is implemented as a shell function, not as a shell script or binary in env/bin. You can verify that by running:

    type -t deactivate 
    function
    

    To run the function and deactivate the virtualenv, just run deactivate

    PS: This behaviour is the same for all shells, it is not special to fish.