I have Python 3.7 && I would like to create a python 2.7 virtual environment to run some code that only works on python 2.7
How do I create this python 2.7 virtual environment?
python3 -m venv ?
venv
doesn’t allow creating virtual environments with other versions of Python than the one currently installed. You would have to use the traditional virtualenv package which allows creating virtual environments for different versions of python by providing the path to the binary like this:
virtualenv --python=/usr/bin/python2.7 /path/to/virtualenv/
where the path /usr/bin/python2.7
refers to the path of the binary for Python 2.7 on your system.