Wednesday, November 17, 2021

[SOLVED] Exiting vs Deactivating a Virtual Environment

Issue

Is there really a difference between exiting, exit, and deactivating, deactivate, your virtualenv terminal shell when working with virtual environments?


Solution

Not much for most of virtual environments. With exit the current shell exits and you are in its parent shell. deactivate cleans up environment for the current shell. No big deal.

But there is a subtle case where the difference matters — temporary environments. Temporary environments is a feature of virtualenvwrapper. You create a temporary environment and virtualenvwrapper removes it on deactivating. Simply exiting in that case is not enough.



Answered By - phd