To uninstall all the packages in your python virtual environment, run the below command. It will first fetch the list of all the installed packages using pip freeze and then will pass this list to the pip uninstall command.

pip freeze | xargs pip uninstall -y

If you face any issue in this method, let us know by writing comments below.

Happy Coding!