python编译报错_python 3.8.1 编译报错 Could not import runpy module 问题

Loading...

## 环境

- CentOS Linux release 7.7.1908 (Core)

- Gcc 4.8.5

- Python 3.8.1

## 相关报错

```python

make build_all CFLAGS_NODIST=" -fprofile-use -fprofile-correction" LDFLAGS_NODIST=""

make[1]: Entering directory `/usr/local/src/Python-3.8.0'

./python -E -S -m sysconfig --generate-posix-vars ;\

if test $? -ne 0 ; then \

echo "generate-posix-vars failed" ; \

rm -f ./pybuilddir.txt ; \

exit 1 ; \

fi

Could not import runpy module

Traceback (most recent call last):

File "/usr/local/src/Python-3.8.0/Lib/runpy.py", line 15, in

import importlib.util

File "/usr/local/src/Python-3.8.0/Lib/importlib/util.py", line 14, in

from contextlib import contextmanager

File "/usr/local/src/Python-3.8.0/Lib/contextlib.py", line 4, in

import _collections_abc

SystemError: returned NULL without setting an error

generate-posix-vars failed

make[1]: *** [pybuilddir.txt] Error 1

make[1]: Leaving directory `/usr/local/src/Python-3.8.0'

make: *** [profile-opt] Error 2

```

## 导致原因

在低版本的gcc版本中带有--enable-optimizations参数时会出现上面问题

gcc 8.1.0修复此问题

## 解决方法

1、升级gcc至8.1.0【不推荐】

2、./configure参数中去掉--enable-optimizations

## 参考链接

> https://bugs.python.org/issue34112

最后修改:2020 年 04 月 17 日 04 : 23 PM

© 允许规范转载

赞赏

如果觉得我的文章对你有用,请随意赞赏

×Close

赞赏作者

扫一扫支付

支付宝支付

微信支付

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值