Last active
August 29, 2015 14:21
-
-
Save nonrational/153707479b8e846361d7 to your computer and use it in GitHub Desktop.
list system and pip-installed modules available to the current python context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys as s | |
for m in s.modules.values(): | |
if hasattr(m, '__file__'): | |
print(m.__file__) | |
else: | |
print(m) | |
import pip | |
for p in pip.get_installed_distributions(): | |
if hasattr(p, 'location'): | |
print(p.location + "/" + p.key) | |
else: | |
print(p) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install globally | |
pip install -r requirements.txt | |
python < list_available_modules.py | |
# install to custom path | |
pip install -r requirements.txt --target .pip; | |
PYTHONPATH=.pip:$PYTHONPATH python < list_available_modules.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment