One method is to use the output of a command like python -c "import powerline as _; print(_.__path__[0])"
which will print out the package directory. using that as a base path you can then invoke powerline.sh. Here's what I have in my .bash_profile for this:
#Powerline shell invoke
## Note: if you've upgrade pyenv and have with old powerline installed,
## make sure you 'pyenv shell' to the older release and
## uninstall powerline first. Otherwise you'll get 'command not found' errors.
## 1. start daemon - done in 'quiet' mode for speed optimization
powerline-daemon -q
## 2. start powerline shell
export POWERLINE_SITE_PACKAGE_PATH=`python -c "import powerline as _; print(_.__path__[0])"`
. $POWERLINE_SITE_PACKAGE_PATH/bindings/bash/powerline.sh
Warning: you might need something more sophisticated than this if you regularly use pyenv local environments.
Note: Could you cache this value so I don't have to invoke python every time? Theoretically yes, but then it gets complicated in terms of checking when a change happens. You may as well just paste the absolute path in. You need to either save the path to a file and clear it. Keeping it simple for now. Merely testing for the variable (by doing something like if [ -z ${POWERLINE_SITE_PACKAGE_PATH+x} ] ; then .....; fi
won't persist across bash sessions.
answer inspired by How do I find the location of my Python site-packages directory?