How to deactivate a Python Virtual Environment -virtualenv

Let's say you create a virtual environment for your Python project as below,

% cd ~/Desktop 
% mkdir mypyproj
% cd mypyproj 
% virtualenv mypyproj_venv

created virtual environment CPython3.11.4.final.0-64 in 258ms

Now to activate this virtual environment you run the below command,

Windows:
 mypyproj_venv\Scripts\activate
Linux/macOS
source mypyproj_venv/bin/activate

Once the virtual environment is active you will see your prompt something like the below,

(mypyproj_venv)  Code2care@Mac % 

Now to exit or deactivate the virtualenv simply type deactivate on the prompt.

deactivate

And you should be out of it!

How to deactivate Python Virtual Environment Example

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!