0

I have a python development environment supporting Python 3.4.5. Right now, I would like to create a virtual environment using vritualenv. In this virtual environment, I need to support Python 2.7 instead since some of to-be-used Python programs only work for Python 2.7. How to create this virtual environment. Thanks.

user288609
  • 12,465
  • 26
  • 85
  • 127
  • 1
    Possible duplicate of [How to use virtualenv with Python?](http://stackoverflow.com/questions/35017160/how-to-use-virtualenv-with-python) – McGrady Apr 11 '17 at 05:06

1 Answers1

2

If you already have Python 2.7 installed, then you can pass an argument to virtualenv to use a different Python version, like this:

virtualenv --python=python py27env

Note that is it practice that python points to python 2.x, whereas python3 points to python 3.x - if your system layout is different, adjust the command appropriately.

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
  • Hi Burhan, I posted a related question in another post, http://stackoverflow.com/questions/43334455/the-contradiction-between-whereis-python-and-python-version which includes the information of my python development environment. Based on which, it seems that I do not have python 2.7, then how should I do? – user288609 Apr 11 '17 at 13:25