The Python version under CentOS is generally low, and many applications need to be upgraded to Python. The default Python version I installed for CentOS is V2.6.3, but the version that runs node. JS needs to be above 2.5.
1. To download the python3.3 installation package:
Yum Install readline-devel.x86_64
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
2. Unzip the installation package: TAR-ZXVF python-3.5.2.tgz
3. Enter the extracted directory: CD Python-3.5.2
4. Create the installation directory: mkdir/usr/local/python3.5
5. Compile and install:./configure--prefix=/usr/local/python3.5
6. Execute: Make && make install
7. The new version of the installation is complete, but since the old version is still in the system, you need to change the original/usr/bin/python link to a new connection:
A. Modify the old connection first, execute: Mv/usr/bin/python/usr/bin/python_bak.
B. Re-establishing a new connection: Ln-s/usr/local/python3.5/bin/python3.5/usr/bin/python
C. Setting environment variables path= $PATH:/usr/local/python3.5/bin/
8. Querying Python version, executing: Python--version
Python 3.5.2
The installation is successful.
Modify the Yum Python parser to Python2.6
Vim/usr/bin/yum #修改第一行
#!/usr/bin/python2.6
If the custom-installed Python 3.5.2 backspace and arrows do not work,
Yum Install readline-devel.x86_64
Re-configure, make, make install, done!!
[email protected] ~]# cat python_install.sh
#!/bin/bashyum Install READLINE-DEVEL.X86_64VERSION=2.7.9MAIN=2.7CD ~wget https://www.python.org/ftp/python/$ version/python-$version. TGZTAR-ZXVF python-$version. TGZCD python-$versionmkdir/usr/local/python$version./ Configure--prefix=/usr/local/python$versionmake && make Installmv/usr/bin/python/usr/bin/python_bakln-s/ Usr/local/python$version/bin/python$main/usr/bin/pythonpath= $PATH:/usr/local/python$version/python--versioncd ~ RM-RF python-$version. tgz python-$version
Upgrade python3.5.2 under Linux (CentOS)