MacOS Python: how to install additional packages

Piet van Oostrum piet-l at vanoostrum.org
Sun Dec 9 15:42:15 UTC 2018


Jens Tröger <jens.troeger at light-speed.de> writes:

> Hello,
>
> I was playing around with LO on my Mac, particularly with the Python
> interpreter and uno.  Now I need a few more packages in that Python
> environment, and it gets tricky.  There is no virtual env installed,
> when I attempt to create one, compiling modules fails because the build
> tools differ between my system and LO’s Python.
>
> For example:
>
>   $ /Applications/LibreOffice.app/Contents/Resources/python
>   Python 3.5.5 (default, Sep 11 2018, 01:20:06) 
>   [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
>   Type "help", "copyright", "credits" or "license" for more information.
>   >>> import pip
>   >>> pip.main(['install', 'regex'])
>
> fails as well as 

There are some links missing in /Applications/LibreOffice.app/Contents/Frameworks/LibreOfficePython.framework/

I could get some modules installed by first executing:
ln -s /Applications/LibreOffice.app/Contents/Frameworks/LibreOfficePython.framework/Versions/3.5/{include,lib} /Applications/LibreOffice.app/Contents/Frameworks/LibreOfficePython.framework/

and then for example 
>>> import pip
>>> pip.main(['install', 'requests'])

But 'regex' fails in the compilation because stdio.h cannot be found. Maybe specifying an appropriate CFLAGS or CPPFLAGS environment variable might solve that.
-- 
Piet van Oostrum <piet-l at vanoostrum.org>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]


More information about the LibreOffice mailing list