Last active
May 10, 2016 01:53
-
-
Save snare/1c16d67fbb78ccb2e6efe16c32fbb353 to your computer and use it in GitHub Desktop.
Print the path to an installed Python library
This file contains 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
# useful for $ subl `pyfile $mod` | |
pypath() { | |
PY=$(python -c "import $1; print($1.__file__)"|sed 's/pyc/py/') | |
if [ $(basename "$PY") != "__init__.py" ] | |
then | |
echo $PY | |
else | |
echo $(dirname "$PY") | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment