I'm trying to find the path to the Python executable QGIS 3.6 is using on Mac OS. Usually (i.e. Python "outside" of QGIS) I'd:

import sys

But that only gives me the path to QGIS:


Is there any straightforward way to find this out?


I found the information 'leaked' if I caused an error from the QGIS Python console...


Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/code.py", line 91, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
NameError: name '__dict__' is not defined

I see you're on a Mac. I'm pretty sure that Mac QGIS requires the use of the 'standard' python3 framework (i.e. not a Brew version) so it should match the output of which python3

I think you can also work it out from the environment

import os; print(os.environ["PATH"])
  • Both ways work, thanks! – Carsten Mar 10 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.