remove virtual environment created with venv in python3 remove virtual environment created with venv in python3 python python

remove virtual environment created with venv in python3


Yes, delete the directory. it's where executables for the venv and modules and libraries and entire other stuff for venvs is kept.


You should deactivate your environment first. Not sure if not deactivating will cause any problem, but that's the right way to do it. Once you deactivate, you can simply delete the virtual environment directory.

To deactivate, simple execute the 'deactivate' bash command anywhere inside your virtual environment tree.


In your venv project folder created using python3 -m venv . or whatever, run this to remove the venv files:

rm -r bin include lib lib64 pyvenv.cfg share

If you're still in the venv by using source bin/activate, run deactivate first.

However, according to this page, one should always use python3 -m venv venv so the venv files are neatly contained in a single venv folder in your project root. That way the Visual Studio Code Python extension can find/use it as well.