CentOS Installation python3.6

Source: Internet
Author: User

Download the Python installation package

Cd/usr/local/src

Compile with the GCC compiler and zlib zlib-devel in advance.

1. Download the file

wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz

2. Decompression

TAR-ZXVF python-3.6.0.tgz

3. Go to unzip directory

CD Python-3.6.0

4. Compiling the installation package

./configure--prefix=/usr/local/python make && make install

5. Add Environment variables

#echo path= '/usr/local/python/bin/: $PATH ' >>/etc/profile
#source/etc/profile

6, check whether successful, execute the following code

Python3.6python 3.6.0 (Default, June  1, 14:01:43) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on Linuxtype "Help", "Co Pyright "," credits "or" license "for more information.>>> print (' Hello word ') Hello Word

  

Python Installation FAQs:

(1) configure:error:no acceptable C compiler found in $PATH

Solution: Yum install-y gcc

(2): Zipimport. Zipimporterror:can ' t decompress data

FIX: Install zlib zlib-devel

1, modify the system's default Python path, because the input Python command in the terminal is the default point of Python2.6.6

mv/usr/bin/python/usr/bin/python-2.6.6

  

2, establish a new soft connection, point to Python-3.6.0

Ln-s/usr/local/python/bin/python3.6/usr/bin/python

  

3, because Yum is dependent on python, so here we modify the default Python, it is necessary to modify the Yum, let it run to the old version:

Vi/usr/bin/yum

Modify "#!/usr/bin/python" in the first row to "#!/usr/bin/python-2.6.6" and save

4, open a new terminal, through the python command into the Python environment, you can see that has pointed to our newly installed python3.6.0:

  

CentOS Installation python3.6

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.