python 3.8.0 编译报错 Could not import runpy module 解决方案(转)
环境CentOS 7gcc 4.8.5Python 3.8.0相关报错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 syscon
·
环境
- CentOS 7
- gcc 4.8.5
- Python 3.8.0
相关报错
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
更多推荐
已为社区贡献3条内容
所有评论(0)