The wiki page for common problems should give an example of how to install Python with a shared library. A shared library is needed in any embedded system where the Python library itself has to be linked to a dynamically loaded module.
The prime example of this is mod_wsgi.
For Linux it is a simple matter of using:
CONFIGURE_OPTS=--enable-shared pyenv install 2.7.10