Loading... <div class="tip share">请注意,本文编写于 1668 天前,最后修改于 1668 天前,其中某些信息可能已经过时。</div> ## 环境 - 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 <module> import importlib.util File "/usr/local/src/Python-3.8.0/Lib/importlib/util.py", line 14, in <module> from contextlib import contextmanager File "/usr/local/src/Python-3.8.0/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 `/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 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏