Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I had Ubuntu 10.04 installed, which came with Python 2.6. Then I installed 3.1 and just used either one. At one point I think I installed a bunch of libraries as well, must've used apt-get to get a package of compiled libraries or something.

Either way, I updated to 10.10, which I think has Python2.7 as default. But if I run python in the console I still get the 2.6 shell. The problem I have is that I want to use ordered dictionaries, yet because I'm in 2.6 I can't. All the packages are installed in the 2.6 version, so I can only use 2.7 for trivial things. For example, 2.7 doesn't have PIL, numpy, opencv etc.

I tried removing the symbolic link from /usr/bin/python that was pointing to /usr/bin/python2.6 and adding a new one to /usr/bin/python2.7, and while it works, all my libraries are still in the old version. I then tried installing pip, but it didn't run. Returning /usr/bin/python to 2.6 however made pip work, which means it was installed for the 2.6 version despite my attempt to use it with 2.7.

Any suggestions that will help me upgrade without formatting or going bald?

Edit: this guy had a similar problem and no solution. :(

share|improve this question

migrated from stackoverflow.com Dec 9 '10 at 22:21

This question came from our site for professional and enthusiast programmers.

2  
askubuntu.com –  Jochen Ritzel Dec 9 '10 at 1:17
1  
Not without breaking a lot of stuff in the OS. You can always have a python27 command... –  Rafe Kettler Dec 9 '10 at 1:17
1  
@Rafe I already have Python2.7. But I don't see how that solves it. –  otirra Dec 9 '10 at 1:28
1  
@otirra same way you can specify python3 instead of python, you could specify python27 to get 2.7 instead of 2.6. It's just having a different terminal command pointing to the python 2.7 executable. See ubuntuforums.org/archive/index.php/t-385593.html –  Rafe Kettler Dec 9 '10 at 1:42
1  
@Rafe I don't understand. I already have python2.7 working in the terminal. Then? Download pip2.7 or something and install the libraries? –  otirra Dec 9 '10 at 1:49

1 Answer 1

I think you need to set PYTHONPATH after changing the links. On a fresh install of Ubuntu 10.10 I just did, I have:

evadeflow(57)% echo $PYTHONPATH 
/home/evadeflow/lib/python2.6/site-packages:/usr/lib/python2.6/site-packages

You should set this in your environment so it points to the version you want to use (i.e., change the 2.6 to 2.7...)

share|improve this answer
1  
Mine is empty. So I should download the libraries, put them in a lib folder and have that in the PYTHONPATH? –  otirra Dec 9 '10 at 1:29
    
Hmm. Nevermind what I said about PYTHONPATH, then. Did you type sudo easy_install pip when you installed pip, or sudo easy_install-2.7? I think you have to type the latter, or at least change the #! line in /usr/local/bin/pip so that it uses python2.7 rather than python2.6 (or just python). Here's what I have: –  evadeflow Dec 9 '10 at 22:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.