Python 3.64 installation, upgrade GCC (version too low install error)

Source: Internet
Author: User
Tags create directory

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 TTP://mirrors.sohu.com/python/3.6.4/python-3.6.4.tgz

3. Installing Python3

I personally used to install in/usr/local/python3 (specific installation location to see a person's preferences)
Create directory: Mkdir-p/usr/local/python3

Unzip the downloaded PYTHON-3.X.X.TGZ package (the specific package name is not different from the specific version of Python you downloaded, such as: I downloaded Python3.6.4. Then I'm python-3.6.4.tgz here)

TAR-ZVXF python-3.6.4.tgz

Results found make failed

Reference to the article found that the GCC version is too low to install 4.8.2 or more

Upgrade code see below, upgrade is version 6.1

wget http://ftp.gnu.org/gnu/gcc/gcc-6.1.0/gcc-6.1.0.tar.gztar-zvxf gcc-6.1.0.tar.gz--directory=/usr/local/cd/usr /local/gcc-6.1.0./contrib/download_prerequisitesmkdir Build CD Build: /configure-enable-checking=release-enable-languages=c,c++-disable-multilib make-j4 #编译时间有点长 One-hour make install

  

Upgrade GCC Process error handling 

# View logs, search "error" cat Config.log|grep # issue:configure:error:c++ compiler missing or inoperational# no C + + compiler Yum Install gcc-c++# issue:conftest.cpp:11:2: Error: #error-static-libstdc++ not implemented# no c,c++ static library yum install glibc-static Li bstdc++-static-y# but the "no package libstdc++-static available", that is, there is no-static-libstdc++ source, the problem still exists. # "Checking whether g++ accepts-static-libstdc++-static-libgcc" times out, can be ignored checking how to run the C + + preprocessor .../lib/ cppconfigure:error:c++ preprocessor "/lib/cpp" fails sanity checksee ' Config.log ' for more details.        /lib/cpp fails sanity check is resolved in some software, run./configure will error: configure:error:c++ preprocessor "/lib/cpp" fails san ity check See ' config.log ' For more details Workaround: This occurs because the relevant package of the C + + compiler is not installed, logged in as root, executed on the terminal: # Yum Install Glibc-he Aders # yum Install gcc-c++

4, enter the extracted directory, compile and install.

    [Email protected]/]# tar-xzvf/usr/local/src/python-3.6.4.tgz-c/usr/local/src/    [[email protected]/]# Cd/usr/lo cal/src/python-3.6.4    [[email protected] python-3.6.4]#./configure--prefix=/usr/local/python3    [email Protected] python-3.6.4]# make-j4    [[email protected] python-3.6.4]# make install

5. Add the Python command to the environment variable:

   [Email protected]/]# vi ~/.bash_profile    path= $PATH: $HOME/bin    instead:    path= $PATH: $HOME/bin:/usr/local/ Python3/bin
[[email protected]/] # source ~/.bash_profile

6. Change the system default Python version to Python3.6

    [Email protected]/]# mv/usr/bin/python/usr/bin/python2.6    [[email protected]/]# ln-s/usr/local/python3/bin/ Python3.6/usr/bin/python


The problem with Yum not working correctly after the Python upgrade is resolved:

#vi/usr/bin/yum

#!/usr/bin/python the head of the file
Change into #!/usr/bin/python2.6



Python 3.64 installation, upgrade GCC (version too low install error)

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.