I would like to get a list of Python modules, which are in my Python installation (UNIX server).
How can you get a list of Python modules installed in your computer?
I would like to get a list of Python modules, which are in my Python installation (UNIX server).
How can you get a list of Python modules installed in your computer?
Since pip version 1.3, you've got access to:
Which seems to be syntactic sugar for "pip freeze". It will list all of the modules particular to your installation or virtualenv, along with their version numbers. Unfortunately it does not display the current version number of any module, nor does it wash your dishes or shine your shoes.
I normally use
pip list
to get a list of packages (with version).This works in a virtual environment too, of course.
If you are using Python 3
I just tried on Ubuntu, and it seems to have worked
Debian / Ubuntu:
sudo apt-get install python3-matplotlib
Fedora:
sudo dnf install python3-matplotlib
Red Hat:
sudo yum install python3-matplotlib
Arch:
sudo pacman -S python-matplotlib
Source: https://matplotlib.org/users/installing.html
I just use this to see currently used modules:
which shows all modules running on your python.
For all built-in modules use:
Which is a dict containing all modules and import objects.
sys.modules
pip
), you may look atpip.get_installed_distributions()
For the second purpose, example code:
As of pip 10, the accepted answer will no longer work. The development team has removed access to the
get_installed_distributions
routine. There is an alternate function in thesetuptools
for doing the same thing. Here is an alternate version that works with pip 10:Please let me know if it will or won't work in previous versions of pip, too.