CentOS Python3 version replaces Python2 version

Source: Internet
Author: User

1. Download #wget wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

2. Unzip and install

 #tar  zxvf python-3.6.1.tgz#cd python-3.6.1#./configure --prefix=/var/local/ Python appears configure: error: no acceptable c compiler found in  $PATHyum  install gcc -y appears zipimport. Zipimporterror: can ' t decompress data; zlib not available Workaround: 1, install dependent zlib, ZLIB-DEVEL  YUM -Y INSTALL ZLIB-DEVEL2, recompile installation python./configure  edit Modules/setup file   Find the following sentence, remove the comment   #zlib  zlibmodule.c -i$ (prefix)/include -l$ (exec_prefix)/lib -lz   RECOMPILE installation: #make  && make install 

3. This is already installed in/var/local/python3, but the input #python--version shows the original python, the original Python file is in/usr/local/bin. There are two ways to do this: soft joins and direct replacements. Here I was directly replaced.

If it is a soft connection, you can try using the #ln-fs/usr/local/src/python-3.6.1/python/usr/bin/python


CentOS Python3 version replaces Python2 version

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.