Installing the Python3 under CENTOS7

Source: Internet
Author: User

Environment Construction

Preparation tools:

    • Centos7:http://mirror.bit.edu.cn/centos/7/isos/x86_64/centos-7-x86_64-dvd-1611.iso
    • Virtuslvox:https://www.virtualbox.org/wiki/downloads
    • Subline
    • SecureCRT
1. After installing the virtual machine, add the image file, select Minimal to minimize the installation
    • Yum update# Update Software
    • Yum-y Install gcc kernel-devel kenel-headers make bzip2 # installation dependent libraries
    • Reboot # restart
2. Mount the execution script
  • Mount/dev/cdrom/mnt # mount the optical drive to the MNT directory
  • Cd/mnt # Enter into the MNT directory
  • Sh./vboxlinuxadditions. Run # Execute the script to install
  • Reboot #重启
3. Take a snapshot for later recoveryInstallation of 4.python environment (installation pyenv)Configuration of CentOS
$ yum Install readline readline-devel readline-static-y$ yum install OpenSSLOpenSSL-devel openssl-static-
   
    y$ Yum Install SQLite-devel-
    y$ yum install bzip2-devel bzip2-libs-
    y$ yum install patch vim git
     
   
Installing PYTHON3.3/PIP3
#Installing python3.3$ sudo mkdir/usr/local/python3#Create the installation directory$ wget--no-check-certificatehttps://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz #下载源文件. Note: When wget gets HTTPS, add:--no-check-certificate$ TAR-XZVF python-3.6.0.tgz#Unpack the package$ CD Python-3.6.0#go to unzip directory#Compiling the installation$ sudo./configure--prefix=/usr/local/python3#Specify the Created directory$ sudo make$ sudo make install#Configure 2 versions to coexist$ sudo ln-s/usr/local/python3/bin/python3/usr/bin/python3#Create Python3 Soft links so that Python 2,python3 can be used with Python 3 using Python commands. #Modify Default to Python 3$ sudo mv python python.bak $ sudo ln-s/usr/local/python3/bin/python3/usr/bin/python#Create soft links for Python3$ sudo vi/usr/bin/yum#because Yum uses Python 2, it may not work correctly after replacing with Python 3, so the Yum configuration file is modified. Change the python version specified in the first line to python2.7 (#!/usr/bin/python to #!/usr/bin/python2.7)
# SOURCE installation pip$ wget--no-check-certificate https://github.com/pypa/pip/archive/9.0.1.tar.gz#  Download Source code $ tar-zvxf 9.0.1-c pip-9.0.1    #  Unzip the file $ cd pip-9.0.1$ python3 setup.py install# using Python 3 installation # to create a link #  upgrade Pip

Installing Setuptools

TAR-XVF setuptools-1.4.2. TAR.GZCD setuptools-1.4.2python setup.py install

Install Python3 under Centos7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.