On 09/18/2016 08:03 AM, Amir Teymuri wrote: > > > My default python version on my Debian 8.5 machine is *3.4.2*. I want to > use python *2.7* for only one project. I have tried running all of the > following commands in the terminal one by one, : > > virtualenv -p python2.7 env_dir > virtualenv -p python2 env_dir > virtualenv --python=python2.7 env_dir > > And this is the file.py inside the env_dir: > > print "Hello world from inside env_dir" > > Obviously however the file.py still gets executed with python3.4.2, because > i run: > > python file.py > > and i get: > > File "file.py", line 1 > print "Hello world from inside env_dir" > ^SyntaxError: Missing parentheses in > call to 'print' > > What is the problem, why it fails to run the code in python2.7?
I can't reproduce here: --------------------------- %< ----------------------------- $ /opt/Python-3.4.3/bin/virtualenv -p python2.7 /tmp/foobar Running virtualenv with interpreter /home/tseaver/bin/python2.7 New python executable in /tmp/foobar/bin/python2.7 Also creating executable in /tmp/foobar/bin/python Installing setuptools, pip.../done. $ /tmp/foobar/bin/python Python 2.7.11 (default, Feb 22 2016, 07:44:44) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> --------------------------- %< ----------------------------- Do you have a version of `python2.7` available on the machine? Tres. -- =================================================================== Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design" http://palladion.com -- You received this message because you are subscribed to the Google Groups "virtualenv" group. To unsubscribe from this group and stop receiving emails from it, send an email to python-virtualenv+unsubscr...@googlegroups.com. To post to this group, send email to python-virtualenv@googlegroups.com. Visit this group at https://groups.google.com/group/python-virtualenv. For more options, visit https://groups.google.com/d/optout.