Yes i have a python 2.7 installed on my machin. On Sep 18, 2016 2:03 PM, "Amir Teymuri" <amirteymur...@gmail.com> 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? > > *Update* > > I have also tried: > > virtualenv -p /usr/bin/python2.7 env_dir > > source env_dir/bin/activate > > (env_dir) amir@amir-debian:~/env_dir$ python file.py > File "file.py", line 1 > print "Insid virtual env" > ^SyntaxError: Missing parentheses in call to 'print' > > Running python -V after activating returns: *Python 3.4.2* > > -- > You received this message because you are subscribed to a topic in the > Google Groups "virtualenv" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/python-virtualenv/pQMSeVDZRiw/unsubscribe. > To unsubscribe from this group and all its topics, 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. > -- 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.