Pipx installs virtualenv with python3.9, any way to force 3.7

Following the official installation guide for virtualenv pipx install virtualenv i get

installed package virtualenv 20.4.2, Python 3.9.0
  These apps are now globally available
    - virtualenv
done! ✨ 🌟 ✨

And following that when I create a new virtualenv with virtualenv -p python3 venv, this includes python3.9 instead of python3.7 which the python 3 version I get when running which python3.

Is there any way I can instruct virtualenv to use the python3 version that is enabled in my computer?

If your 3.7 is accessible, let’s say which python3.7 returns a valid path, you can use that path instead, like so:

virtualenv -p $(which python3.7) new_env

Your proposal makes sense but I guess what I was trying to understand is why python3 which is associated with python 3.7 in my shell is not used when creating the virtualenv.

I think it’s because you used pipx to install virtualenv

pipx basically creates a ‘private’ virtualenv to run a program you installed through it, which in your case, was virtualenv. So whenever you invoked virtualenv, it will default to the python3 it found in the virtualenv, and since the virtualenv was created with Python 3.9, then by default all the symlinks python and python3 points topython3.9.

CMIIW