-1

For work reasons, i have to use Python 2.7.9. On my system, OS X Yosemite, i have version 2.7.11. There is a way to set up an enviroment via virtualenvwrapper in order to use that specific version of Python?

g_rmz
  • 721
  • 2
  • 8
  • 20
  • 1
    You should have a look at this SO question: http://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv#11301911 – niklas Apr 16 '16 at 09:24

2 Answers2

1

Take a look at the -p option:

$ virtualenv --help
Usage: virtualenv [OPTIONS] DEST_DIR

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -v, --verbose         Increase verbosity.
  -q, --quiet           Decrease verbosity.
  -p PYTHON_EXE, --python=PYTHON_EXE
                        The Python interpreter to use, e.g.,
                        --python=python2.5 will use the python2.5 interpreter
                        to create the new environment.  The default is the
                        interpreter that virtualenv was installed with
                        (/usr/bin/python3.5)

You need to install Python 2.7.9 on your system first. And as said in another answer, you can have multiple Python versions installed on your system side by side.

totoro
  • 2,469
  • 2
  • 19
  • 23
0

You can have multiple binaries of python on the same system. Install the version you need and use this command.

virtualenv -p {python binary location} {name of virtualenv}

The virtualenvwrapper commands mkvirtualenv and mkproject will both accept the -p argument and pass it to virtualenv when creating virtual environments.

snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
Ravi
  • 111
  • 1
  • 9