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

2024/9/16 23:34:19

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.

Answer

Do

sudo update-alternatives --remove-all python
sudo ln -sf /usr/bin/python2.7 /usr/bin/python
https://en.xdnf.cn/q/73009.html

Related Q&A

Function that returns a tuple gives TypeError: NoneType object is not iterable

What does this error mean? Im trying to make a function that returns a tuple. Im sure im doing all wrong. Any help is appreciated.from random import randint A = randint(1,3) B = randint(1,3) def make_…

Error when plotting DataFrame containing NaN with Pandas 0.12.0 and Matplotlib 1.3.1 on Python 3.3.2

First of all, this question is not the same as this one.The problem Im having is that when I try to plot a DataFrame which contains a numpy NaN in one cell, I get an error:C:\>\Python33x86\python.ex…

Java method which can provide the same output as Python method for HMAC-SHA256 in Hex

I am now trying to encode the string using HMAC-SHA256 using Java. The encoded string required to match another set of encoded string generated by Python using hmac.new(mySecret, myPolicy, hashlib.sha2…

How to get response from scrapy.Request without callback?

I want to send a request and wait for a response from the server in order to perform action-dependent actions. I write the followingresp = yield scrapy.Request(*kwargs)and got None in resp. In document…

install error thinks pythonpath is empty

I am trying to install the scikits.nufft package here I download the zip file, unpack and cd to the directory. It contains a setup.py file so I run python setup.py installbut it gives me the following …

Conditionally installing importlib on python2.6

I have a python library that has a dependency on importlib. importlib is in the standard library in Python 2.7, but is a third-party package for older pythons. I typically keep my dependencies in a pip…

Python/pandas: Find matching values from two dataframes and return third value

I have two different dataframes (df1, df2) with completely different shapes: df1: (64, 6); df2: (564, 9). df1 contains a column (df1.objectdesc) which has values (strings) that can also be found in a c…

random.choice broken with dicts

The random.choice input is supposed to be a sequence. This causes odd behavior with a dict, which is not a sequence type but can be subscripted like one: >>> d = {0: spam, 1: eggs, 3: potato} …

Tornado [Errno 24] Too many open files [duplicate]

This question already has an answer here:Tornado "error: [Errno 24] Too many open files" error(1 answer)Closed 9 years ago.We are running a Tornado 3.0 service on a RedHat OS and getting the …

How to check if an RGB image contains only one color?

Im using Python and PIL.I have images in RGB and I would like to know those who contain only one color (say #FF0000 for example) or a few very close colors (#FF0000 and #FF0001).I was thinking about us…