Can download each version of the python:https://www.python.org/ftp/python/configuration installation
Download the latest installation package (as of 2013/11/05) or version 3.3.2.
#wget http://python.org/ftp/python/3.5.2//Python-3.5.2.tgz#tar xzf Python-3.5.2.tgz#cd Python-3.5.2#./configure --prefix=/opt/apps/python3#make#make install
If prefix is not specified, it is installed by default under/usr/local, so it can be found in path. We want to install a version that can be copied and installed, so it is installed in the specified directory.
Setting up the environment
/opt/apps/python3/bin can be added to the system environment variable,
#echo ‘export PATH=$PATH:/opt/apps/python3/bin‘ >> ~/.bash_profile
And we are easy to set up soft links more convenient
#ln -s /opt/apps/python3/bin/python3 /usr/bin
Confirm Installation Success
# python3 -VPython 3.5.2
Install PIP
PIP is convenient for installing dependent software, so it is recommended to install.
#wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - |python3#wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py -O - |python3#ln -s /opt/apps/python3.5/bin/pip-3.5 /usr/bin/
Install required third-party libraries
such as Mysql-connector and requests
#pip-3.5 install mysql-connector-python#pip-3.5 install requests
If the following error occurs when you install PIP:
ImportError: No module named bz2
This indicates that the installed Python 3 is missing a dependent library bzip2-devel and needs to install the dependent libraries before compiling the installation.
To view the compiled parameters for the installed Python, refer to: StackOverflow
Original address: CentOS 6 installs Python 3, thanks to the original author to share.
Installing Python 3 under CentOS 6