How to upgrade python 2.6 to python 2.7 in ubuntu

I installed ubuntu 10.04 and it comes with python2.6. How can I upgrade it to 2.7?

+6
source share
2 answers

You can also install the python2.7 package. Then you can determine the python version with shebang ( #!/usr/bin/env python2.7 ) or even use #update-alternatives --config python to make it the default interpreter. But it can break a lot of system applications ...

update: sometimes there is no alternative to python, so you will need to create them manually. Something like update-alternatives --install /usr/bin/python python2.7 /usr/bin/python2.7 10

update2: however, if you only need 2.7 for your project, I would suggest using virtualenv: virtualenv -ppython2.7 myproject

+7
source

Download python 2.7.2 and follow the step. Just remember using make install dont do make altinstall , this will not make python 2.7 as the default python interpreter.

Edit: do not replace or remove python 2.6, if it is related to the distribution, this may lead to package breaking.

+2
source

Source: https://habr.com/ru/post/907637/


All Articles