4

I am a newbie in python and I am trying to add a new environment for my project which runs fine on my current environment Python 3.7.5 After adding all the dependency I was facing an issue for pyttsx3 package(for python text to speech) on researching further I found out that this was a problem with python version Python 3.7.6 https://github.com/nateshmbhat/pyttsx3/issues/136

which was the python version for my current virtual environment. These are the steps that I have followed for install the environment

  1. py -m pip install --user virtualenv
  2. py -m venv env
  3. To activate : .\env\Scripts\activate

https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/

I want that I can either get Python 3.7.7 or Python 3.7.5(on my current machine) for my virtual environment.

I am using Visual studiocode IDE .

1

1 Answer 1

8

You can do

virtualenv -p python3.7.5 [name]

but you need to have python3.7.5 in your $PATH or you will get

RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.7.5'

So, you would better use conda

conda create --name [name] python=3.7.5
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, it worked :)
If you've got more than one version of python installed, and thinking of creating a virtual environment with a specific version, say you've got python3.8 and python3.9, then you can create a virtual environment like so; python3.8 -m venv <your preferred virtual environment name>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.