Description: CentOS 7 minimized installation, default Python 2.7, development requires installation of python3.6.1.
1. Check Python version
[Email protected] ~]# python-v
Python 2.7.5
[Email protected] ~]#
2. Install the necessary library files
# yum-y Install zlib zlib-devel gcc
3. Download python3.6.1 to/usr/local directory
# wget HTTPS://WWW.PYTHON.ORG/FTP/PYTHON/3.6.1/PYTHON-3.6.1.TAR.XZ
4. Decompression and Installation
# xz-d PYTHON-3.6.1.TAR.XZ
# TAR-XVF Python-3.6.1.tar
# CD PYTHON-3.6.1/
#./configure Prefix=/usr/local/python3
# Make && make install
5. Add Environment Variables Permanently
# Vim/etc/profile
Add Export path= "$PATH:/usr/local/python3/bin"
Source/etc/profile after adding finished
* * Temporarily add environment variable to # export path= "$PATH:/usr/local/python3/bin" After terminal end environment variable takes effect
6. Open python3.6
[Email protected] ~]# Python3
Python 3.6.1 (default, May 19 2017, 04:11:00)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on Linux
Type "Help", "copyright", "credits" or "license" for more information.
>>>
7. Modify/usr/bin/python Link
# Cd/usr/bin
# mv Python Python.bak
# ln-s/usr/local/python3/bin/python3.6/usr/bin/python
# ln-s/usr/local/python3/bin/python3.6/usr/bin/python3
Modify to open Python3 directly with # python
CentOS 7 Installation python3.6.1