by pixelmonkey · 7y ago · 0 comments
pycd () {
pushd `python -c "import os.path, $1; print(os.path.dirname($1.__file__))"`;
}
Example usage, with abbreviated $PWD shown after "»" and shell commands entered after "$" in this example session: » (~/repos/web)
$ pycd flask
» (~/./v/3/e/w/l/p/s/flask)
$ pwd
~/.pyenv/versions/web+site/lib/python3.6/site-packages/flask
» (~/./v/3/e/w/l/p/s/flask)
$ head app.py
# -*- coding: utf-8 -*-
"""
flask.app
~~~~~~~~~
This module implements the central WSGI application object.
:copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details.
"""
» (~/./v/3/e/w/l/p/s/flask)
$ popd
~/repos/web ~
» (~/repos/web)
$
So, usually lets you explore the source code, at the command-line, for any Python libraries you have installed.No comments yet.