Python Learning-linux installation of Python3

Source: Internet
Author: User
Tags install openssl openssl

Python is usually installed in/usr/local/python3 (a specific installation location to see a person's preference, but to remember the location of the installation), because the/usr/local directory does not exist in the directory Python3, so first create a new directory:

mkdir /usr/local/python3
1. Download Python3 from official website
https://www.python.org/downloads/
2. Install dependent environment

The installation of Python3 requires these four dependencies: gcc, zlib, Zlib-devel, Openssl-devel
Then install each of the four software separately:

yum install gcc -yyum install zlib -yyum install zlib-devel -yyum install openssl-devel -y
3. Unzip the downloaded Python3 installation package

(1) because the/OPT directory is the third-party software storage directory, so we move the downloaded installation package to the/OPT directory, and then execute the decompression command in the directory:

tar -zvxf Python-3.6.4.tgz    ##我的安装包是3.6.4的。
4. Compiling the installation

Enter the extracted directory and compile it within the directory. (Be sure to compile in the extracted directory, otherwise it will not compile)

cd Python-3.6.4./configure --prefix=/usr/local/python3    ##注意有位小数点符号。--prefix是指定安装目录,这里指定安装目录是/usr/local/python3make && make install
5. Configure Environment variables
echo export PATH="/usr/local/python3/bin:$PATH" >> ~/.bashrcsource ~/.bashrc
6. Check if the installation is successful

Re-open a shell, enter the command Python3 can enter into the Python interactive environment is installed successfully.

Python Learning-linux installation of Python3

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.