Is there a way in Python to list all installed packages and their versions?
I know I can go inside python/Lib/site-packages and see what files and directories exist, but I find this very awkward. What I’m looking for something that is similar to npm list i.e. npm-ls.
If you have pip install and you want to see what packages have been installed with your installer tools you can simply call this:
It will also include version numbers for the installed packages.
Update
pip has been updated to also produce the same output as
pip freezeby calling:Note
The output from
pip listis formatted differently, so if you have some shell script that parses the output (maybe to grab the version number) offreezeand want to change your script to calllist, you’ll need to change your parsing code.