Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My python installation is broken/corrupted. How do I fix it?

I followed these instructions on my RedHat Linux version 7 server (which originally just had Python 2.6.x installed):

beginning of instructions

install build tools

sudo yum install make automake gcc gcc-c++ kernel-devel git-core -y

install python 2.7 and change default python symlink

sudo yum install python27-devel -y
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python

yum still needs 2.6, so write it in and backup script

sudo cp /usr/bin/yum /usr/bin/_yum_before_27
sudo sed -i s/python/python2.6/g /usr/bin/yum
sudo sed -i s/python2.6/python2.6/g /usr/bin/yum

should display now 2.7.5 or later:

python -V 

end of instructions

The above commands and comments were taken from:

http://www.lecloud.net/post/61401763496/install-update-to-python-2-7-and-latest-pip-on

The python -v command returned this:

-bash: python: command not found

Now it is as if I have no Python installed. I don't want yum to break. I tried installing Python 3.4.

whereis python shows this:

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

What should I do now? I want a working installation of Python. For certain things I'm doing, I need it to be 2.7 or higher. I want yum to still work.

like image 990
Propulsion Avatar asked Mar 08 '15 00:03

Propulsion


1 Answers

Do

sudo update-alternatives --remove-all python
sudo ln -sf /usr/bin/python2.7 /usr/bin/python
like image 200
Dr Manhattan Avatar answered Nov 14 '22 23:11

Dr Manhattan