python 2 instead of python 3 as the (temporary) default python? python 2 instead of python 3 as the (temporary) default python? python python

python 2 instead of python 3 as the (temporary) default python?


You can use virtualenv

# Use this to create your temporary python "install"# (Assuming that is the correct path to the python interpreter you want to use.)virtualenv -p /usr/bin/python2.7 --distribute temp-python# Type this command when you want to use your temporary python.# While you are using your temporary python you will also have access to a temporary pip,# which will keep all packages installed with it separate from your main python install.# A shorter version of this command would be ". temp-python/bin/activate"source temp-python/bin/activate# When you no longer wish to use you temporary python typedeactivate

Enjoy!


mkdir ~/binPATH=~/bin:$PATHln -s /usr/bin/python2 ~/bin/python

To stop using python2, exit or rm ~/bin/python.


Just call the script using something like python2.7 or python2 instead of just python.

So:

python2 myscript.py

instead of:

python myscript.py

What you could alternatively do is to replace the symbolic link "python" in /usr/bin which currently links to python3 with a link to the required python2/2.x executable. Then you could just call it as you would with python 3.