William
William

Reputation: 4028

How to create virtualenv with specific downloaded python version

I know there are some similar questions,but it is really hard for me to finish it.

I'm trying to create a virtualenv with python 3.7.7 in windows.

I have a downloaded python 3.7.7

C:\Users\willi\AppData\Local\Programs\Python\python-3.7.8-embed-amd64

Since I can built a virtualenv using:

python3 -m venv myenv

So I tried to modify it ,so that it can match specific python version:

python3 -m C:\Users\willi\AppData\Local\Programs\Python\python-3.7.8-embed-amd64\python.exe myenv

But it failed:

ModuleNotFoundError: No module named 'C:\\Users\\willi\\AppData\\Local\\Programs\\Python\\python-3')

Any friends can teach me how to build a virtualenv with python 3.7.7?

Upvotes: 1

Views: 2734

Answers (1)

swati bohidar
swati bohidar

Reputation: 99

I think you haven't installed virtual environment in your local python

pip install virtualenv

and follow your steps. Stil, find the error. Try doing below methods, I think you will get your answer-

in command prompt

pip install virtualenv

go to the location, where you want to create your environment

cd location
virtualenv project_env_name

Now, you will find a python env in the desired location, Then go to scripts

cd project_env_name/scripts
activate

You will enter the environment you created. while leaving the environment, do

deactivate

To leave the environment.

This method works if you want to create the same python version environment as python version in your machine. If you want to create an environment of the different version, you need to install the python of that version.

Upvotes: 1

Related Questions