CentOS 7 Installation Python3.6 process (let Linux systems coexist Python2 and PYTHON3 environments)

Source: Internet
Author: User
Tags python script

The CentOS 7 system comes with Python2, but you can run the Python script directly with Python3 without the 2 version, but do not move the system's own Python2, because the program relies on the current python2 environment, such as Yum, Yum will not work, and other programs may be affected. Understand the above, and then come to install the Python3.6:

Installation steps:

1. Install dependent environment

# yum-y Install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-de Vel libpcap-devel xz-devel

2. Download Python3

https://www.python.org/downloads/

1 # wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
3. Installing Python3

Package installed in/usr/local/python3 (specific installation location to see a person's preferences)
To create a directory:

1 # mkdir -p /usr/local/Python3

Unzip the downloaded PYTHON-3.6.5.TGZ package (specific package name because you download the specific version of Python, I downloaded the Python3.6.5 here to take python-3.6.5.tgz as an example)

1 # tar -zxvf Python-3.6.5.tgz
4. Enter the extracted directory, compile and install

If the compilation of the installation process has an error message to see my other essay written solution http://www.cnblogs.com/shwee/p/9013851.html

12 # cd Python-3.6.5# ./configure --prefix=/usr/local/Python3

Then: Make

1 # make

Next: Make Install

1 # make install

Or two-step together: Make && make install

5. Set up the Python3 soft chain
1 # ln -s /usr/local/Python3/bin/python3 /usr/bin/python3
6. And add/usr/local/python3/bin to path
123456789 # vim ~/.bash_profile# .bash_profile# Get the aliases and functionsif-f ~/.bashrc ]; then. ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/bin:/usr/local/Python3/binexport PATH

Press ESC, enter: Wq, press ENTER to save exit edit.

After the modification, remember to execute the following line command to make the previous modification effective:

1 # source ~/.bash_profile

Check if Python3 and PIP3 are normally available:

1234 # python3 -VPython 3.6.5
# pip3 -Vpip 9.0.3 from/usr/local/Python3/lib/python3.6/site-packages (python 3.6)


Hong Wei

Source: http://www.cnblogs.com/shwee/

CentOS 7 Installation Python3.6 process (let Linux systems coexist Python2 and PYTHON3 environments)

Related Article

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.