No usr/bin/python

Hi,
I’m a new user and I’m having some trouble with setting up passenger.
I’ve followed all the related the tutorials, but I get this error:
*** ERROR ***: Cannot execute /usr/bin/python: No such file or directory (2)
I’m currently using a custom python3 installation.
When passneger runs passenger_wsgi.py it defaults to usr/bin/python
but this file doesn’t exist in my directory.
Also I have tried #!/home/username/opt/python-3.9.7/bin/python3
but to no avail.
Thank you in advacne.

Things I would check.

Adding the path to the install into you .bash_profile
export PATH=$HOME/opt/python-3.9.7/bin:$PATH

Then sourcing it.
. ~/.bash_profile

More info here:
https://help.dreamhost.com/hc/en-us/articles/115000702772-Installing-a-custom-version-of-Python-3

Next, ideally, you’ll want to create a virtual environment for each different project. This is not the same as a virtual machine. What this does is copies some files to a new location and points to some files in the original location. This way you can install some dependencies for one project and have other dependencies for another. An example for a good reason to do this, let’s say you have two sites that have overlapping dependencies, but one of them uses a differerent version because it has a specific tool that needs that version, you can update one without crashing the other.

After pip installing virtualenv, and going into sites top level folder.

virtualenv -p /home/username/opt/python-3.10.1/bin/python3 venv
virtualenv is the command
-p is the path to the version of python you want it to point to
venv was the name used in the example, i like to prefix it with the project name, locally I may have multiple venv’s in the same folder.

https://help.dreamhost.com/hc/en-us/articles/115000695551-Installing-and-using-Python-s-virtualenv-using-Python-3

Then in your passenger_wsgi file, you point to your venv binary
INTERP = "/home/username/example.com/venv_name/bin/python3"

This will cover the basics and have links to the above topics as well.
https://help.dreamhost.com/hc/en-us/articles/360002341572-Creating-a-Django-project