MacOS Python: how to install additional packages

Jens Tröger jens.troeger at light-speed.de
Thu Dec 6 06:35:22 UTC 2018


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 

  $ cd /Applications/LibreOffice.app/Contents/Resources
  /Applications/LibreOffice.app/Contents/Resources > ./python -m venv .
  /Applications/LibreOffice.app/Contents/Resources > ./bin/pip install regex

fails. Including LO’s path into PYTHONPATH like I would do on Linux
doesn’t work either:

  >>> import uno
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/Applications/LibreOffice.app/Contents/Resources/uno.py", line 19, in <module>
      import pyuno
  ModuleNotFoundError: No module named 'pyuno'

What’s the recommended approach here?

Cheers,
Jens

-- 
Jens Tröger
http://savage.light-speed.de/


More information about the LibreOffice mailing list