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 removed the default python install from my linux using rpm command without removing the dependencies, I was trying to install 2.7 manually, which wasn't working out that is whay I thouht may be it was because of conflict, but it messed up, I am getting this error when I try to evoke python after reinstalling 2.6 again

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting `$PYTHONHOME` to `<prefix>[:<exec_prefix>]`
ImportError: No module named site

I have tried setting PYTHONHOME and PYTHONPATH but it doesn't work so well, I get the last error ImportError: No module named site and also other programs like yum don't function. What should I do? Also when I installed 2.7 I used --libdir=/usr/lib64 to configure it.

My system is 64 bit, and I really need it back the way it was, what should I do? can it be solved by using linux rescue? Any help will be appreciated. I spent hours online reading the solutions from other users facing the same problem but it didn't help.

Using the whereis command I found these:

python: /usr/bin/python /usr/bin/python2.6 /usr/bin/python2.6-config /usr/lib/python2.3 /usr/lib/python2.6 /usr/lib64/python2.6 /usr/local/bin/python /usr/local/bin/python2.7-config /usr/local/bin/python3.2m /usr/local/bin/python3.2 /usr/local/bin/python3.2m-config /usr/local/bin/python2.7 /usr/local/bin/python3.2-config /usr/local/lib/python3.2 /usr/include/python2.6 /opt/python2.7/bin/python2.7-config /opt/python2.7/bin/python2.7 /usr/share/man/man1/python.1.gz

What should I do? I can't live invoking python manually all the time when I am programming.

I am using Scientific Linux 6.3

share|improve this question
1  
Uh oh. Yum is written in python. Rescue might help, but it's probably easier to just back up and reinstall. Good luck! –  Colin Dunklau Aug 24 '12 at 22:25
    
+1 for a fresh install. It won't take long and you'll be much happier afterwards. –  hayden Aug 24 '12 at 22:33
    
A really Powerful operating system falling apart in a situation like this :( is there any way to upgrade python to higher versions that could solve this problem, for me its really not a good Idea to reinstall because I have been setting up my linux for a really long time, this is the first time I've been into this kind of situation. –  Anshu Aug 24 '12 at 22:42
    
Can you describe exactly what command(s) you used to uninstall and then reinstall python? –  Rajesh J Advani Aug 25 '12 at 3:42
    
It IS possible to have multiple versions of Python installed on your system. You don't need to remove the original one. Some system management tools are written in it, and you shouldn't touch that Python installation. If installing newer version from source just do "make altinstall" as the final step. Then put as your bangline #!/usr/bin/python2.7 for your scripts. –  Keith Aug 27 '12 at 5:44
add comment

migrated from stackoverflow.com Aug 27 '12 at 3:25

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

1 Answer

If you want to install python from sources, it's usually best to do so in /usr/local/ somewhere, and let the system default python live where it wants.

I agree, it's going to be hard to restore python without a full reinstall.

Something you might be able to do: Tar up the default python on another Sci Linux system (even a virtual machine), and extract it on your original system. This might work well enough to get you going again. But safest is probably to do a full reinstall.

share|improve this answer
add comment

Your Answer

 
discard

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