I am using Eclipse on Linux to develop C applications, and the build system I have makes use of make and python. I have a custom virtualenv installed and managed by pyenv, and it works fine from the command line if I pre-select the virtualenv with, say pyenv shell myvenv.
However I want Eclipse to make use of this virtualenv when building (via "existing makefile") from within Eclipse. Currently it runs my Makefile but uses the system python in /usr/bin/python, which is missing all of the packages needed by the build system.
It isn't clear to me how to configure Eclipse to use a custom Python interpreter such as the one in my virtualenv. I have heard talk of setting PYTHONPATH however this seems to be for finding site-packages rather than the interpreter itself. My virtualenv is based on python 3.7 and my system python is 2.7, so setting this alone probably isn't going to work.
I am not using PyDev (this is a C project, not a Python project) so there's no explicit support for Python in Eclipse. I'd prefer not to install PyDev if I can help it.
I've noticed that pyenv adds its plugins, shims and bin directories to PATH when activated. I could explicitly add these to PATH in Eclipse, so that Eclipse uses pyenv to find an interpreter. However I'd prefer to point directly at a specific virtualenv rather than use the pyenv machinery to find the current virtualenv.
PYTHONPATHto/home/user/.pyenv/versions/myvenv/lib/python3.7/site-packagesdoes seem to complete the build, but I'm not sure if it's locating the correct python interpreter based on this directory - is that possible? Would settingPYTHONPATHaffect the actual interpreter used? Or just the packages that are available for import? - davidA