Separate version of python inside a virtual environment

The python version on my server is 3.7 and I have done python -m venv env but is it possible to install python 3.12 in my env ? I can’t seem to find references to install python itself inside a virtual environment.

You don’t install Python in a virtual environment. You install Python on the Operating System, then create a virtual environment using that version of Python.