Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
462 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
In Python, there are times when you want to remove all external modules from a given environment. This tip shows you how.
First, execute pip freeze > requirements.txt in the terminal to create a text document listing all installed modules.
This is a quick way to check what will be deleted.
Python will generate a new text file in the current folder.
You can use a different name for the file.
Opening the .txt file will show the modules currently installed in this environment.
The pyjokes module that many of Sam's delegates grow to fear.
We can use pip uninstall -r requirements.txt to read each module from the text file and ask you to confirm their uninstallation.
Press y to confirm the module uninstallation or n to skip it.
You can uninstall all modules at once by adding a -y to the end to default all confirmations to yes.
You could also use this trick with install to add all modules from the document.
Python will list out each module and the outcome of the uninstall command.
Don't worry we can reinstall pyjokes when no one is looking.
You can learn more about this topic on the following Wise Owl courses:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2025. All Rights Reserved.