Installing Python 3
CentOS 7 comes with Python 2.7, so if you want to use Python 3, you'll need to reinstall Python 3
1, download the Python3.5 package
wget HTTPS://WWW.PYTHON.ORG/FTP/PYTHON/3.5.1/PYTHON-3.5.1.TAR.XZ
2. Unpack the TAR Package
TAR-ZXVF PYTHON-3.5.1.TAR.XZ
3. Move Python below the/usr/local
MV Python-3.5.1/usr/local
4. Enter the Python directory
Cd/usr/local/python-3.5.1/
5. Installing the GCC software suite
Yum Install GCC
6. Configuration
./configure
7. Compiling
Make
8, compile, install
Make install
9. Delete the old soft connection, create a new soft connection to the latest Python
Rm-rf/usr/bin/python
Ln-s/usr/local/bin/python3.5/usr/bin/python
10. Because Yum uses python2, it may not continue to work properly after being replaced with Python3 python2.7.5
Modify the Yum config file (sudo vi/usr/bin/yum) to change the #!/usr/bin/python of the file header to #!/usr/bin/python2.7 save and exit.
Install python pip
Because of distributions like CentOS, sometimes the source updates are compared, so when you use Yum to search Python-pip, you will say that the package is not found. Therefore, to be able to install these packages, you need to install the extension source Epel
EPEL (Http://fedoraproject.org/wik/EPEL) is a project built by the Fedora community to deliver high-quality software packages for Rhel and derivative distributions such as CentOS, Scientific Linux, etc.
First install the Epel extension source
sudo yum-y install Epel-release
Then install Python-pip
Suo yum-y Install Python-pip
Clear the cache after the installation is complete
sudo yum clean all
Add the PYTHONPATH environment variable in the shell to increase the search path for Python (/home/vamei/mylib)
Export pythonpath= $PYTHONPATH:/home/vamei/mylib
CentOS 7 under Python environment settings-1