How to open virtualenv in python3?
Asked Answered
T

3

6

I have both python 2.7 and 3.8 installed in my computer but whenever I would install virtualenv using pip install virtualenvwrapper-win and then open a new virtualenv using mkvirtualenv test it says Running virtualenv with interpreter /usr/bin/python2. Now I downloaded django in the virtualenv and got the outdated version 1.11. So now I am unable to import path from django.urls among other things.

Is there any way to install vitrualenwrapper with python3 interpreter? Please help. I am trying to learn django and this is creating a huge hassle.

Tutuila answered 2/8, 2020 at 18:6 Comment(0)
M
1

You can create a virtual environment for any Python version by giving the python interpreter as an argument:

mkvirtualenv -p /path/to/python_binary test
Mercurochrome answered 2/8, 2020 at 18:35 Comment(0)
W
6

Virtualenv is already included in standard library of the Python3. You can create a virtual environment using the command below:

python3 -m venv venv

The second venv is the name of your virtualenv, you can name it as you want.

To use an existing virtualenv you should use the command:

path_to_your_venv\Scripts\activate.bat

https://docs.python.org/3/library/venv.html

Woodard answered 2/8, 2020 at 18:10 Comment(0)
M
1

You can create a virtual environment for any Python version by giving the python interpreter as an argument:

mkvirtualenv -p /path/to/python_binary test
Mercurochrome answered 2/8, 2020 at 18:35 Comment(0)
S
0

virtualenvwrapper should be installed into the same global site-packages area where virtualenv is installed. You may need administrative privileges to do that. The easiest way to install it is using pip:

 pip3 install virtualenvwrapper

or:

sudo pip3 install virtualenvwrapper
Serpentine answered 2/8, 2020 at 18:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.