[Bf-python] Loading shared library in Blender Python

Sybren A. Stüvel sybren at stuvel.eu
Wed Jun 17 15:59:02 CEST 2015


Hi Pierrick,

On Wed, Jun 17, 2015 at 03:49:23PM +0200, Pierrick Koch wrote:
> I'd like to imort python package from ubuntu distribution into
> blender. Their shared object extension is
> .cpython-34m-x86_64-linux-gnu.so, while Blender look for
> .cpython-34m.so (without "-x86_64-linux-gnu").

How did you gather this knowledge? It helps a lot to see what you're
actually doing.

> Do you know any way to override this issue, or a way to let Blender
> Python look for both extension ?

What I did is the following:

- Create a director ~/.local/lib/python3.4/site-packages
- Symlink packages from /usr/lib/python3/dist-packages into that dir.

For example, I have the following in that dir:

scipy -> /usr/lib/python3/dist-packages/scipy/
scipy-0.14.0.egg-info -> /usr/lib/python3/dist-packages/scipy-0.14.0.egg-info
shapely -> /usr/lib/python3/dist-packages/shapely/
Shapely-1.3.0.egg-info -> /usr/lib/python3/dist-packages/Shapely-1.3.0.egg-info

This allows me to import shapely and scipy into Blender 2.75-rc1 just
fine:

>>> import shapely
>>> shapely.__file__
'/home/sybren/.local/lib/python3.4/site-packages/shapely/__init__.py'

If you run into any issues, don't hesitate to mail back with a nice
error message ;-)

Best,
-- 
Sybren A. Stüvel

http://stuvelfoto.nl/
http://stuvel.eu/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20150617/a1e8016b/attachment.sig>


More information about the Bf-python mailing list