安装python3.9

GCC版本

这个版本的编译器不适合编译Python3.9,在编译时会产生如下的错误。我们用这个老版本编译器编译一个新的GCC 9.2版。

Could not import runpy module
Traceback (most recent call last):
  File "Python-3.8.1/Lib/runpy.py", line 15, in <module>
    import importlib.util
  File "Python-3.8.1/Lib/importlib/util.py", line 14, in <module>
    from contextlib import contextmanager
  File "Python-3.8.1/Lib/contextlib.py", line 4, in <module>
    import _collections_abc
SystemError: <built-in function compile> returned NULL without setting an error
generate-posix-vars failed
make[1]: *** [pybuilddir.txt] Error 1
make[1]: Leaving directory `Python-3.8.1'
make: *** [profile-opt] Error 2

下载gcc

wget https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz
tar zxvf gcc-9.2.0.tar.xz 
cd gcc-9.2.0/
编译时出现如下错误
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.

 错误信息中说明,安装gcc需要这三个依赖:GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+。

错误信息,提示了下载页面的地址:ftp://gcc.gnu.org/pub/gcc/infrastructure/。

打开链接:ftp://gcc.gnu.org/pub/gcc/infrastructure/。
或者 yum install  gmp  gmp-devel  mpfr  mpfr-devel  libmpc  libmpc-devel
找到需要的三个包地址,下载下来:
wget https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz


      wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2

      wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2

      wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz

安装GMP:      
tar -jxvf gmp-6.1.0.tar.bz2
cd gmp-6.1.0
./configure
make && make install
安装MPFR:
tar -jxvf mpfr-3.1.4.tar.bz2
cd mpfr-3.1.4
./configure
make && make install
安装MPC: 
tar -zxvf mpc-1.0.3.tar.gz
cd mpc-1.0.3
./configure
make && make install


编译安装会出现/usr/include/gnu/stubs.h:7:27: 错误:gnu/stubs-32.h:没有那个文件或目录
yum install glibc-devel.i686
mkdir build && cd build
$ ../configure --prefix=/usr/local --disable-multilib --enable-languages=c,c++
$ make && sudo make install


移除gcc
yum remove gcc

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

凤舞飘伶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值