Skip to content

Instantly share code, notes, and snippets.

@snare
Last active May 10, 2016 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snare/1c16d67fbb78ccb2e6efe16c32fbb353 to your computer and use it in GitHub Desktop.
Save snare/1c16d67fbb78ccb2e6efe16c32fbb353 to your computer and use it in GitHub Desktop.
Print the path to an installed Python library
# 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