1

I have a problem with Linux in PC. I installed python3.8. I want work with python 3. When I create a virtualenv file it gets created with python2, but I don't want work with python2. How can I enable python2?

5
  • can you post the code you're using to create the virtualenv? Commented Dec 20, 2019 at 15:31
  • 1
    Type python3 instead of python while executing commands. Commented Dec 20, 2019 at 15:31
  • 1
    Does this answer your question? Using Python 3 in virtualenv Commented Dec 20, 2019 at 15:31
  • virtualenv file name Commented Dec 20, 2019 at 15:33
  • Is there a typo in "How can I enable python2?", you do not want to run any python2 in this venv. You want a python3.x interpreter Commented Dec 20, 2019 at 15:38

2 Answers 2

5

You can set a python version while creating a new virtual environment using the -p flag.

virtualenv -p python3.8 my-env-name
Sign up to request clarification or add additional context in comments.

Comments

0

Perhaps you can try to locate the location of the python version you want to use the interpreter of (eg. get its path through which python3). Once obtained the path you can create the enviroment specifying the location of the interpreter you want to use for that virtual environment virtualenv -p /usr/bin/python3.6 venv

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.