1

I want to create virtual environment using python3. But it takes python2 by default. I have both python2 and 3 installed on my machine.

The ouput of when I create the virtual environment is:

$ virtualenv .env Running virtualenv with interpreter /usr/bin/python2 New python executable in /some/path/.env/bin/python2 Also creating executable in /some/path/.env/bin/python Installing setuptools, pkg_resources, pip, wheel...done.

I would like to specify which python version to use in the virtualenv.

0

2 Answers 2

2

When using virtualenv these are the usual steps to follow:

Create the virtualenv using a specific python version of your liking using the -p or --python arguments

virtualenv -p /usr/bin/your-python ./path-where-to-create-venv

Activate the virtualenv, in order to install libraries et cetera

source ./venv-path/bin/activate

You can see that you're working from inside the virtualenv, you can deactivate using

deactivate

Sign up to request clarification or add additional context in comments.

Comments

0

use

virtualenv --python=python3.5 myenv

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.