16

I am trying to create a virtual environment using mkvirtualenv with python 3 in Windows but the environment is created with python 2.7.My pip version is also from python 2.7 which i have avoided using

py -m pip install virtualenvwrapper-win

When i do

mkvirtualenv test

environment is created with python 2.7 Please help me with a solution Thanks in advance:)

phd
  • 82,685
  • 13
  • 120
  • 165
AVA
  • 173
  • 1
  • 1
  • 6
  • Does this answer your question? [Error using virtualenvwrapper-win passing in different python version](https://stackoverflow.com/questions/29567097/error-using-virtualenvwrapper-win-passing-in-different-python-version) – phd May 20 '20 at 15:10
  • https://stackoverflow.com/search?q=%5Bvirtualenvwrapper%5D+different+python+versions – phd May 20 '20 at 15:10

2 Answers2

27

If you would like to create a virtualenv with python 3.X having the version 2.X

You just have to pass a parameter argument for your virtual env.

$ virtualenv venv -p $(which python3)

This command will point to your current python3 install folder, and create a virtualenv copied from your current python3 binaries.

If you would like to see what this command does, just fire the command:

$ which python3
#should print your current python3 binary folder.
Danizavtz
  • 3,166
  • 4
  • 24
  • 25
14

you need install python3.8 to your enviroment, if you are in ubuntu(18.04):

sudo apt install python3.8

and:

mkvirtualenv name_of_the_project -p python3.8
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • instead of `mkvirtualenv name_of_the_project -p python3.8` this worked for me `virtualenv name_of_the_project -p python3.8` – hhhameem Sep 07 '22 at 15:51