Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a web server that is running Debian Linux 4.3.2-1.1 and Python 2.6.5. I would like to upgrade the Python interpreter to 2.7 without having to reinstall my modules. Is there an easy way to do this?

Can I just copy all the files from my /usr/lib/python2.6/site-packages directory to /usr/lib/python2.7/site-packages or will this cause problems?

share|improve this question
I don't know, but you could just try it and see. – starofale Sep 22 '10 at 20:58
I am considering trying it. I am kind of unfamiliar with installing things on Linux, and Python package management so I was afraid that I may be doing things the hard way, or doing something stupid that would mess something up. If I go ahead and try it, I will post here as to whether it went fine. – Elias Zamaria Sep 23 '10 at 18:45
Thanks for the answers. I was thinking that maybe there is some quick, easy, and well-known way to upgrade, but considering the answers I got, it seems like it may be a better idea to reinstall all my modules. – Elias Zamaria Sep 29 '10 at 6:59

Modules that are pure Python may work after copying. Compiled modules will not, and must be recompiled against the new version.

share|improve this answer

That should work fine for most Python packages. Some modules, like setuptools (which includes easy_install), have different eggs for different versions of Python. If anything in the 2.6 site-packages directory has 2.6 in the filename, check PyPI for a 2.7 version. You may also find newer releases of your packages.

As far as I know (without having tried it myself), the only potential problem is that a package won't work if it's Python-version-specific. It shouldn't cause any trouble with the rest of your system.

share|improve this answer

Wouldn't this potentially get better coverage/feedback on serverfault? No snark intended, but with the bounty, it seems like it's a question of value to the asker and I want to see him/her get the best response

edit:What was the basis of deletion? Again, I"m new to superuser so I'm looking for clarification. I realize that the word 'server' does not garner immediate posting on serverfault, but in what context was my suggestion off-base?

share|improve this answer
This is not a Server Fault issue. That the title and question contain the word "server" is incidental. – Ignacio Vazquez-Abrams Sep 28 '10 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .