编译python的时候遇到错误

綵se亱晚 发布于 2018/07/01 15:35
阅读 4K+
收藏 0

环境是centOS7.5x64,python3.7.0,当使用make命令的时候报以下错误

Failed to build these modules:
_uuid

具体的是

/root/python3/Python-3.7.0/Modules/_uuidmodule.c:15:5: error: unknown type name ‘uuid_t’
     uuid_t uuid;
     ^
/root/python3/Python-3.7.0/Modules/_uuidmodule.c:32:5: error: implicit declaration of function ‘uuid_generate_time’ [-Werror=implicit-function-declaration]
     uuid_generate_time(uuid);
     ^
/root/python3/Python-3.7.0/Modules/_uuidmodule.c:33:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return Py_BuildValue("y#O", (const char *) uuid, sizeof(uuid), Py_None);
 

完整的日志如下

[root@DigitalOcean Python-3.7.0]# make
 CC='gcc -pthread' LDSHARED='gcc -pthread -shared  ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall'        _TCLTK_INCLUDES='' _TCLTK_LIBS=''       ./python -E ./setup.py  build
running build
running build_ext
building '_uuid' extension
gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I./Include -I. -I/usr/local/include -I/root/python3/Python-3.7.0/Include -I/root/python3/Python-3.7.0 -c /root/python3/Python-3.7.0/Modules/_uuidmodule.c -o build/temp.linux-x86_64-3.7/root/python3/Python-3.7.0/Modules/_uuidmodule.o
/root/python3/Python-3.7.0/Modules/_uuidmodule.c: In function ‘py_uuid_generate_time_safe’:
/root/python3/Python-3.7.0/Modules/_uuidmodule.c:15:5: error: unknown type name ‘uuid_t’
     uuid_t uuid;
     ^
/root/python3/Python-3.7.0/Modules/_uuidmodule.c:32:5: error: implicit declaration of function ‘uuid_generate_time’ [-Werror=implicit-function-declaration]
     uuid_generate_time(uuid);
     ^
/root/python3/Python-3.7.0/Modules/_uuidmodule.c:33:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return Py_BuildValue("y#O", (const char *) uuid, sizeof(uuid), Py_None);
                                 ^
cc1: some warnings being treated as errors

The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  atexit                pwd
time


Failed to build these modules:
_uuid

running build_scripts
copying and adjusting /root/python3/Python-3.7.0/Tools/scripts/pydoc3 -> build/scripts-3.7
copying and adjusting /root/python3/Python-3.7.0/Tools/scripts/idle3 -> build/scripts-3.7
copying and adjusting /root/python3/Python-3.7.0/Tools/scripts/2to3 -> build/scripts-3.7
copying and adjusting /root/python3/Python-3.7.0/Tools/scripts/pyvenv -> build/scripts-3.7
changing mode of build/scripts-3.7/pydoc3 from 644 to 755
changing mode of build/scripts-3.7/idle3 from 644 to 755
changing mode of build/scripts-3.7/2to3 from 644 to 755
changing mode of build/scripts-3.7/pyvenv from 644 to 755
renaming build/scripts-3.7/pydoc3 to build/scripts-3.7/pydoc3.7
renaming build/scripts-3.7/idle3 to build/scripts-3.7/idle3.7
renaming build/scripts-3.7/2to3 to build/scripts-3.7/2to3-3.7
renaming build/scripts-3.7/pyvenv to build/scripts-3.7/pyvenv-3.7
[root@DigitalOcean Python-3.7.0]#

是缺失了什么没有安装嘛? 

加载中
0
多多de棉花糖
多多de棉花糖

使用这个可以解决: export CPPFLAGS=" -Wno-error=coverage-mismatch"

多多de棉花糖
多多de棉花糖
回复 @綵se亱晚 : 刚遇到这个问题,需要增加这个环境变量在.bash_profile里面,然后就没问题了
綵se亱晚
綵se亱晚
emmm,当时是想装WAS来着,但是现在已经没有这个需求了,暂时就把你作为最佳答案吧
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部