MacOS Python: how to install additional packages

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


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/
  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/
  /Applications/ > ./python -m venv .
  /Applications/ > ./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/", line 19, in <module>
      import pyuno
  ModuleNotFoundError: No module named 'pyuno'

What’s the recommended approach here?


Jens Tröger

More information about the LibreOffice mailing list