If I want to keep my venv as clean as possible how can I clean up the stuff I don't need? Let me lay out an example...
Say I try a bunch of new modules...
pip install foo
pip install bar
pip install foobar
pip install foobarfoo
and these modules have some requirements of their own, etc. later I decide on which one I want to use, but then I have a huge list of stuff in my requirement.txt and I can't remember what I need and what I don't, what depends on what, etc.
How can I keep it clean and lean?
There is no command for deleting your virtual environment. Simply deactivate it and rid your application of its artifacts by recursively removing it. Note that this is the same regardless of what kind of virtual environment you are using.
The traditional location is ~/. virtualenvs. I use a different setup where I have a ~/projects folder which contains the different virtualenvs and contains the python code for different projects. This is nice and easy because you have everything together.
Click on the Parallels icon on the Mac menu bar > select Control Center. Right-click on your virtual machine and select Remove "virtual machine name"... files if you wish to access the files from this virtual machine later. The virtual machine will be removed from the list, but it will remain in its original location.
To uninstall every package (including dependencies) you can freeze the requirements and then pass them to pip uninstall
:
pip freeze > to-uninstall.txt
pip uninstall -r to-uninstall.txt
The following works for me (can be executed from any Python 3.6 virtualenv
):
virtualenv --clear your-env-name
Where your-env-name
could be:
virtualenv-wrapper
, just the name of the environmentIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With