Where is the Python executable embedded in LibreOffice on macOS?

Following this question, I have decided to use Python instead of Basic as a scripting language. Now trying to follow tutorials here and here, I can’t find the Python executable in the path:

/Applications/LibreOffice.app/Contents/MacOS/python

My environment is :

  • LibreOffice 6.3.2.2 98b30e735bda24bc04ab42594c85f7fd8be07b9c
  • macOS Mojave Version 10.14.6

I would appreciate it if you could help me know where can I find the Python executable, or install it if required.


P.S.1. So far I have installed the APSO - Alternative Script Organizer for Python and then ran the plugin:

                                   

and then ran the Python shell:

                                   

and then from here ran the commands:

import sys
print(sys.executable)

which weirdly enough returns:

/Applications/LibreOffice.app/Contents/MacOS/soffice


P.S.2. It seems that my question is not properly understood. Please consider that I have no problem finding other Python executables for example using which python or which python3. My issue is that there is no python executable in the path described in the tutorials!

On my macOS:

$ls -l $(which python)
lrwxr-xr-x  1 root  wheel  75 Dec 12 17:29 /usr/bin/python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

Dear @anon73440385 , Please consider that I have no issue finding my Python executables. I can’t follow the tutorials finding any executable in the specified path

/Applications/LibreOffice.app/Contents/MacOS/

In principle, Python is installed by default in nearly all “modern” OSes. To make sure, type in a terminal window: command -v python. If you get an answer, python is installed and the line tells you where it is. Otherwise, use a package manager to download it.

Well, I do have several Pythons installed on my system including the Python2 preinstalled in all macOSes as well as others I have installed myself. the issue is that I can’t find the executable expected in the above path as described in the tutorials here and here.

/Applications/LibreOffice.app/Contents/MacOS/python

In addition to what ajlittoz wrote, try the following code from Find full path of the Python interpreter? - Stack Overflow

import sys
print(sys.executable)

Well, Fining my Python executable is no problem. The issue as I have explained here Is that I can’t find the Python executable embedded into the LO. So it seems the /Applications/LibreOffice.app/Contents/MacOS/soffice is the Python executable which doesn’t make sense!

Perhaps it is located somewhere in /Applications/LibreOffice.app/Contents/MacOS/.

On Linux, which may be similar to macOS, the system python includes LibreOffice macro capability, so there is only one python executable, typically python3 as run from any terminal. There is also plain python which is python 2.7, but that isn’t for newer versions of LibreOffice.

Dear Jim, If it was in that path I would have noticed it for sure :roll_eyes: these are the files I have in that folder:

![](upload://dHNgwOeXCRzkJsZjJH40RpUZBki.png)               

OK, eventually from this comment I found the correct path on macOS is actually:

/Applications/LibreOffice.app/Contents/Resources/python

Some links that may help you getting started with Python & LibreOffice

Happy Python!

note: IDE_utils provides (Libre/Open)Office Python macro simple enablement for IDEs.