CentOS6.x upgrades Python2.6.6 to Python2.7.6 method process

888u

Last update at :2024-06-22,Edit by888u

When we install software in Linux VPS and servers, we need many compatible software versions. For example, when Snail tried the Pagoda panel, he was prompted that he needed Python 2.7 or above before he could install it. I have also shared an article about the installation of this panel in my blog before. It seems that it was installed in the CentOS7.x version. Because the default is Python2.7, this problem was not discovered at the time.

This time the test machine is using the CentOS6. It needs to be this way. But we need to pay attention. It is recommended that if we have important data before upgrading, we recommend backing up the data first, just in case, just in case, you know.

First, check the current Python version

python -V

After checking, we can see that it is Python version 2.6.6. I will not take screenshots here. There are too many trivial things, so I will record the process directly.

Second, upgrade the system and install the development tool kit

yum -y updateyum groupinstall \\”Development tools\\” -y

Third, supplementary component support required for installation

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel -y

Fourth, install Python2.7.6

cd /optwget –no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xztar xf Python-2.7.6.tar.xz. /configure –prefix=/usr/localsudo make && sudo make altinstall

Attention, altinstall is used here.

Fifth, check whether it is installed

/usr/local/bin/python2.7 –version

Currently, we can only check and see the Python 2.7.6 version through this command.

Sixth, create soft links

mv /usr/bin/python /usr/bin/python2.6.6ln -s /usr/local/bin/python2.7 /usr/bin/python

Remove the original old version and create a soft link to 2.7. In this way, we can directly use Python -V to see that it is Python 2.7.6.

Seventh, fix compatibility issues

Here we cannot install the software by executing yum directly. We need to modify yum to make it compatible.

vi /usr/bin/yum

Edit the file and change it at the top to

#!/usr/bin/python2.6.6

After saving, we can perform the installation again. At least when I couldn't install the pagoda panel originally, I can now install it. It seems that the upgraded Python is effective.

Recommended site searches: domain name registration query, PHP space rental, US server URL, domain name registration center, registration query Ministry of Industry and Information Technology, how to bind a domain name to a server, free ASP space, what is a domain name server, US anti-attack server, ICP quick registration ,

CentOS6.x upgrades Python2.6.6 to Python2.7.6 method process

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码