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

**URL:** <https://discuss.python.org/t/pipx-installs-virtualenv-with-python3-9-any-way-to-force-3-7/7076>\
**Category:** Python Help\
**Tags:** help\
**Created:** [February 8, 2021, 8:41am UTC](https://discuss.python.org/t/pipx-installs-virtualenv-with-python3-9-any-way-to-force-3-7/7076 "2021-02-08T08:41:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsorros](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nsorros/32/3448_2.png) [@nsorros](https://discuss.python.org/u/nsorros)\
**Post date:** [February 8, 2021, 8:41am UTC](https://discuss.python.org/t/pipx-installs-virtualenv-with-python3-9-any-way-to-force-3-7/7076/1 "2021-02-08T08:41:04Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![pepoluan](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pepoluan/32/3594_2.png) [@pepoluan](https://discuss.python.org/u/pepoluan)\
**Post date:** [February 27, 2021, 9:29am UTC](https://discuss.python.org/t/pipx-installs-virtualenv-with-python3-9-any-way-to-force-3-7/7076/2 "2021-02-27T09:29:11Z")

</div>

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

```auto
virtualenv -p $(which python3.7) new_env

```

---

<div class="post-metadata">

**Author:** ![nsorros](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nsorros/32/3448_2.png) [@nsorros](https://discuss.python.org/u/nsorros)\
**Post date:** [March 8, 2021, 10:00am UTC](https://discuss.python.org/t/pipx-installs-virtualenv-with-python3-9-any-way-to-force-3-7/7076/3 "2021-03-08T10:00:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pepoluan](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pepoluan/32/3594_2.png) [@pepoluan](https://discuss.python.org/u/pepoluan)\
**Post date:** [March 8, 2021, 10:12am UTC](https://discuss.python.org/t/pipx-installs-virtualenv-with-python3-9-any-way-to-force-3-7/7076/4 "2021-03-08T10:12:53Z")

</div>

> [@nsorros](#):
>
> 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 to`python3.9`.

CMIIW
