1, first view the default system version: Display as 2.7.5
2. We create a Python folder under root to hold the Python installation package we downloaded:
3. Then use the wget command to download the installation package:
wget HTTPS://WWW.PYTHON.ORG/FTP/PYTHON/3.6.4/PYTHON-3.6.4.TAR.XZ
(Note: If the error wget not found, you can use Yum to install the wget before using:
Yum-y Install wget
)
4. Unzip the downloaded file:
Xz-d PYTHON-3.6.4.TAR.XZ
Tar xvf Python-3.6.4.tar
5, enter the extracted source directory to run the following command installation:
Mkdir/usr/local/python3
CD Python-3.6.4
./configure Prefix=/usr/local/python3
(Note: If the error is reported in this step:
Installing gcc:yum-y Install GCC
)
Make
Make install
6. Delete the original Python file:
Cd/usr/bin
MV Python Python.bak
7. Create a new mapping:
Ln-s/usr/local/python3/bin/python3.6/usr/bin/python
8, see the results:
Centos7 Change the default Python version, install python3.6.4