Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Python 2.7.9 over 2.7.6

I'm using Python for my research. I have both version of Python on my system: 3.3.2 and 2.7.6. However due to the compatibility with the required packages (openCV, Numpy, Scipy, etc.) and the legacy code, I work most of the time with Python 2.7.6.

It took me quite a lot of effort at the beginning to set up the environment ready for my works. E.g. I didn't follow the "easy" way of installing all-in-one Anaconda or Enthought Canopy software, instead I installed packages one by one (using pip..), some packages,(scipy, sympy, pandas, lxml) could not be installed by pip and I had to installed using a MSI file.

Now all of them are working fine. I see that Python released the newer version: 2.7.9. My questions are: (1) is it worth upgrading from 2.7.6 to 2.7.9, any benefit in performance, security, stability,...?

(2) will it break/overwrite the current setup of my 2.7.6 environment? I notice there are 2 folders on my C:\, which are Python27 and Python33. As the logic, Python 2.7.9 will also be in the same folder Python27 (as 2.7.6). Do I need to re-install/reconfigure the packages again?

(If there will be a lot of hassles, then perhaps I'll follow the mantra: "if it is not broken, don't fix it"...)


EDIT: Thanks for the comments, but as my understanding, this site is about Q&A: got question & get answered.

It's a simple and direct question, let me make it clearer: e.g. Python has Lib/site-packages folder with my packages inside. Will the new installation overwrite that folder, etc.

People may know or not know about this fact, based on their knowledge or experience. I don't want to experiment myself so I asked, just for my curiosity.

I know there's a trend to reform SO to get better question and answer quality, but I don't know since when the people can be so ridiculously sensitive :) If this one is asked in "Stack Exchange Programming" site, then I can understand that it's not well-suited for that site. Now I understand another effect of the trolls: they make a community become over-sensitive and drive the new/naive newbie away.

like image 475
Jim Raynor Avatar asked Dec 26 '22 00:12

Jim Raynor


2 Answers

You can install the package that already exists in Debian jessie. I recommend doing an apt-get update and apt-get upgrade before starting.

Create /etc/apt/sources.list.d/python-jessie.list and add

deb http://httpredir.debian.org/debian jessie main
deb-src http://httpredir.debian.org/debian jessie main

deb http://httpredir.debian.org/debian jessie-updates main
deb-src http://httpredir.debian.org/debian jessie-updates main

deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main

Add the apt keys for these new repositories

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9D6D8F6BC857C906

We also need an apt-get preferences file which prevents Debian jessie packages with higher versions from taking over.

Create /etc/apt/preferences.d/python-jessie-pin and add

Package: *
Pin: release o=Debian
Pin-Priority: -10

Now you can upgrade python 2.7.9

sudo apt-get update
sudo apt-get install -t jessie python2.7
python --version
like image 173
Andres Restrepo Avatar answered Dec 28 '22 21:12

Andres Restrepo


Upgrading to new version can give you more stable and featured version. Usually this is the case - version 2.7 is mature and stable. I think you do not need to re-install/reconfigure the packages again because of this stability (2.7.6 and 2.7.9 are 2.7 anyway). Problems are hardly possible, although they may be in very small number of cases. And folder with the subversion X.X will be overwrited, because there are no any folders for minor versions X.X.X

Unfortunately, I can not give more precise answer.

like image 20
snotna Avatar answered Dec 28 '22 19:12

snotna