-1

How do I create a virtual enviroment with venv using a specific version of python on m1. I currently have 3.9.6 and I want a virtual enviroment with 3.10. I create my virtual env using : python3 -m venv .

Is there a way I can specify the version, also not a fan of conda.

sinoroc
  • 18,409
  • 2
  • 39
  • 70
Smythe_12
  • 1
  • 1
  • 1
    You might want to take a look at [pyenv](https://github.com/pyenv/pyenv). – Niko Föhr Jul 04 '23 at 16:31
  • Already, didn't work. – Smythe_12 Jul 04 '23 at 16:33
  • 3
    `/path/to/the/desired/python/binary -m venv …` – Klaus D. Jul 04 '23 at 16:39
  • Thanks, so that means I need to download the binary. I never had to use a higher version so am not sure how it. – Smythe_12 Jul 04 '23 at 16:48
  • 1
    Yes, as already mentioned, the Python interpreter must be installed beforehand and then a virtual environment can be created with `pythonX.Y -m venv path/to/venv`. Installing the Python interpreters is out of scope, there are plenty of resources available around to answer that question. – sinoroc Jul 04 '23 at 17:45
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jul 05 '23 at 00:45

1 Answers1

0

Make sure you have python 3.10 installed by running:

python3.10 --version

Then specify in your venv command like this:

python3.10 -m venv .

Hope this helps!

Jack X
  • 1
  • 1