How to find assets of installed pip package
<p>While deploying my application, I need to install a library which contains some assets that must be served from an static directory. That means, during the deploy, I must do the following:</p>

<ol>
<li><code>pip install</code> the package</li>
<li>Find the <em>absolute</em> location where the package has been installed (this is usually <code>site-packages</code> in the virtualenv or global location)</li>
<li>Copy the assets from the installed package to the static directory</li>
</ol>

<p>Is there a portable way of doing step 2? The only starting piece of data that I have to find the installed package is <code>pip</code> / <code>python</code>.</p>

<p>Is there a way to tell <code>python</code>: in what absolute location have you installed a certain package?</p>

<p>See <a href="https://docs.python.org/2/library/pkgutil.html#pkgutil.get_data" rel="nofollow">pkgutil.get_data</a>. File-system based approaches break with packages that are installed as zip-file.</p>

python pip