I am using plain Apache 2.4 on Mac OS Catalina.

I installed pyenv to manage python versions. The default Python is 3.8.0

Now I try to have Python scripts running in Apache. I created a subdomain under localhost that makes sure python code will run. But it seems to use the system python version(s) and not the one from pyenv.

When I use shebang:


Then python 2 is used. Not what I want...

When I use:


It uses the system python3 version (3.7.3) Which is the python at /usr/bin/python3

How do I get Apache to use the "default" python that I see when I execute: "pyenv global"?

1 Answer 1


If the python version you want to use is:


just replace the 1st line of the scripts you want to run with this version of python to say you want to use this interpreter:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .