How to delete a Python Virtual Environment

If you want to delete a Python Virtual Environment in a proper way, then follow the below steps.


Step 1: deactivate the Virtual Environment

    Make sure that the venv than you want to delete is not active. If it is, you can deactivate it as follows,

    Move to the bin folder:

    cd /Users/c2ctech/Desktop/virtualenv/bin

    Run the deactivate command:

    (virtualenv) Code2care@Mac % deactivate

Step 2: Delete the Virtual Environment Directory

    Once we deactivate the virtual environment, we are good to delete the directory once sure that it is no longer needed.

    macOS/Linux/Bash:

    rm -r ~/Desktop/virtualenv 

    Windows:

    rmdir /s /q C:\data\python\virtualenv
    How to delete a Python Virtual Environment

    Comments & Discussion

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