Installing Python3 on Linux

Source: Internet
Author: User

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

# wget Https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

3. Installing Python3

I personally used to install in/usr/local/python3 (specific installation location to see a person's preferences)
To create a directory:

# mkdir-p/usr/local/python3

Unzip the downloaded PYTHON-3.X.X.TGZ package (the specific package name is not different for the specific version of Python you downloaded?) and not different, such as: I downloaded the Python3.6.1. Then I'm python-3.6.1.tgz.

# TAR-ZXVF Python-3.6.1.tgz

4. Enter the extracted directory and compile the installation.

# CD python-3.6.1#./configure--prefix=/usr/local/python3

Make

# make

Make install

Make install    or make && make install

5. Build Python3 's soft chain

# ln-s/usr/local/python3/bin/python3/usr/bin/python3

6. and add/usr/local/python3/bin to Path

# 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 Enter to exit.

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

# source ~/.bash_profile

Check if Python3 and PIP3 are normally available:

# Python3-vpython 3.6.1# pip3-vpip 9.0.1 from/usr/local/python3/lib/python3.6/site-packages (Python 3.6)

7. If not, try creating a soft link to PIP3

# ln-s/USR/LOCAL/PYTHON3/BIN/PIP3/USR/BIN/PIP3

Installing Python3 on Linux

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.