As with every other programming language you need to know who to manage your packages, modules and dependencies. You could always YOLO install every package globally, but as a best practice you should always have separate environments per project hence addressing many issues related to shared libraries such as dependency conflicts. So, first let’s see how to list all local and global packages in Python.
pip global packages
List all Python packages and modules available:
To check a single package version, run:
pip list | grep <package_name>
pip freeze | grep <package_name>
pip local packages
List local Python packages installed by the current user running the following command:
pip list --user
pip freeze --user
To check a certain local package version, run:
pip list --user | grep <package_name>
pip freeze --user | grep <package_name>
To list local Python packages using pipenv, first
cd into your pipenv project and then run the following command:
pipenv run pip list
pipenv run pip freeze -all
Related: Python: pip list vs pip freeze (-all).
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.