Forums

Change default python version

Hi, I would like to have my default python version changed from 2.7 to 3.5. Later on I will start virtual environments but I cannot do it at the moment. So how can I change the default version? Or do I need help to change it on a user level?

I managed to get this done by using virtual environments. My initial problem was that the PYTHONPATH was not set when starting a virtualenviroment which gave me some errors *.pth files installing google or-tools.

Start a virtual environment

virtualenv --python=python3.5 djangovenv

Then edit the activation script

vim djangovenv/bin/activate

and att these two lines a

export OLD_PYTHONPATH="$PYTHONPATH"
export PYTHONPATH="/the/path/you/want"

a line should also be added in the very top of the file within the deactivate function

export PYTHONPATH="$OLD_PYTHONPATH"

Check if the the script is working by writing

echo $PYTHONPATH
source djangovenv/bin/activate
echo $PYTHONPATH
deactivate
echo $PYTHONPATH

Hope this helps someone. Even though the problem description might be a little vague.

The available Pythons are currently:

python2.6 -V   # --> Python 2.6.9 final 0
pypy -V        # --> Python 2.7.10 final 42 v.s. 2.7.13
python -V      # --> Python 2.7.6 final 0   v.s. 2.7.13
python3.3  -V  # --> Python 3.3.6 final 0
python3 -V     # --> Python 3.4.3 final 0
python3.5 -V   # --> Python 3.5.2 final 0
python3.6 -V   # --> Python 3.6.0 final 0   v.s. 3.6.1

The virtualenv trick described above is helpful but requesting Python versions 2.7.7-2.7.13 and 3.6.1 return errors of the form The path python2.7.13 (from --python=python2.7.13) does not exist.

that is correct- we currently don't support 2.7.13. (you will have to use 2.7.10 for now) We are looking into upgrading these for new users in a new system image- we will let you know when that comes out (and you can switch over to the new image)

The table 2 posts up, with all the available python versions -- can you put a copy on the main help page or some other prominent location, and keep it updated? This is a good reference for people considering upgrading to a new virtual environment. Thank you.

I'm not sure I see much point to having that on a web page, since it is so trivially available in a console.

A user may not realize every version that is available (i.e. they might assume "python3 -V" would return the latest version.) Also, some accounts are on older servers... when I query "pypy -V" I do not get 2.7.10. When I query "python 3.6 -V" I get an error -- 3.6 is not available on my server.

I've been thinking for a while that perhaps we should get rid of the "python3", "pip2", etc. links, as they seem to cause confusion rather than help people out. Any thoughts on that?