3

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

5
  • 1
    Uh oh. Yum is written in python. Rescue might help, but it's probably easier to just back up and reinstall. Good luck! Aug 24, 2012 at 22:25
  • +1 for a fresh install. It won't take long and you'll be much happier afterwards.
    – hayden
    Aug 24, 2012 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, 2012 at 22:42
  • Can you describe exactly what command(s) you used to uninstall and then reinstall python?
    – Rajesh J Advani
    Aug 25, 2012 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, 2012 at 5:44

2 Answers 2

4

I had this exact error using CentOS 6.7 (Final) on a 64 bit system. I had to change two paths in order for python to work again. (Specifically gdb was giving me the same error you were getting.)

export PYTHONHOME=/usr/lib64/python2.6/
export PYTHONPATH=/usr/lib64/python2.6/

Other answers were saying to only modify one of those variables or use the non-64bit lib folder. But this was the only method that worked for me. Hopefully this can help someone else. In your case you might want to use the python2.7 folder however. But you can use python2.6 to get back to a working system at least.

0

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.

You must log in to answer this question.

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