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?

  • 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.


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.


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?

  • 3
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.