无法从源代码安装python 3.6.3:目标的配方' Programs / python.o'失败

时间:2017-10-27 08:52:30

标签: python linux

我运行Linux mint 18.2,./configure工作正常,但当我make时,我得到以下内容:

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers   -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
In file included from ./Include/pyport.h:6:0,
                 from ./Include/Python.h:50,
                 from ./Programs/python.c:3:
/usr/local/include/inttypes.h:38:2: error: #error "Use this header only with Microsoft Visual C++ compilers!"
 #error "Use this header only with Microsoft Visual C++ compilers!"
  ^
In file included from /usr/local/include/inttypes.h:48:0,
                 from ./Include/pyport.h:6,
                 from ./Include/Python.h:50,
                 from ./Programs/python.c:3:
/usr/local/include/stdint.h:38:2: error: #error "Use this header only with Microsoft Visual C++ compilers!"
 #error "Use this header only with Microsoft Visual C++ compilers!"
  ^
In file included from /usr/local/include/inttypes.h:48:0,
                 from ./Include/pyport.h:6,
                 from ./Include/Python.h:50,
                 from ./Programs/python.c:3:
/usr/local/include/stdint.h:135:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int64_t’
 typedef signed __int64       int64_t;
                              ^
/usr/local/include/stdint.h:136:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uint64_t’
 typedef unsigned __int64     uint64_t;
                              ^
/usr/local/include/stdint.h:147:9: error: unknown type name ‘uint64_t’
 typedef uint64_t  uint_least64_t;
         ^
/usr/local/include/stdint.h:157:9: error: unknown type name ‘uint64_t’
 typedef uint64_t  uint_fast64_t;
         ^
/usr/local/include/stdint.h:164:30: error: conflicting types for ‘intptr_t’
    typedef _W64 signed int   intptr_t;
                              ^
In file included from ./Include/Python.h:36:0,
                 from ./Programs/python.c:3:
/usr/include/unistd.h:270:20: note: previous declaration of ‘intptr_t’ was here
 typedef __intptr_t intptr_t;
                    ^
In file included from /usr/local/include/inttypes.h:48:0,
                 from ./Include/pyport.h:6,
                 from ./Include/Python.h:50,
                 from ./Programs/python.c:3:
/usr/local/include/stdint.h:170:9: error: unknown type name ‘uint64_t’
 typedef uint64_t  uintmax_t;
         ^
In file included from ./Include/pyport.h:6:0,
                 from ./Include/Python.h:50,
                 from ./Programs/python.c:3:
/usr/local/include/inttypes.h:288:1: error: unknown type name ‘_inline’
 _inline
 ^
/usr/local/include/inttypes.h:290:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__cdecl’
 imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
           ^
/usr/local/include/inttypes.h:290:11: error: unknown type name ‘__cdecl’
In file included from ./Include/Python.h:71:0,
                 from ./Programs/python.c:3:
./Include/pyhash.h:64:9: error: unknown type name ‘uint64_t’
         uint64_t k0;
         ^
./Include/pyhash.h:65:9: error: unknown type name ‘uint64_t’
         uint64_t k1;
         ^
In file included from ./Include/Python.h:79:0,
                 from ./Programs/python.c:3:
./Include/longintrepr.h:47:9: error: unknown type name ‘uint64_t’
 typedef uint64_t twodigits;
         ^
In file included from ./Include/Python.h:87:0,
                 from ./Programs/python.c:3:
./Include/dictobject.h:31:5: error: unknown type name ‘uint64_t’
     uint64_t ma_version_tag;
     ^
Makefile:750: recipe for target 'Programs/python.o' failed
make: *** [Programs/python.o] Error 1

我在同一台机器上成功构建了以前版本的python,不知道这个版本有什么问题, 谢谢,

1 个答案:

答案 0 :(得分:0)

这不是Python问题。出于某种原因,您最终获得了Windows include files for integer definitions的副本:

/usr/local/include/inttypes.h:38:2: error: #error "Use this header only with Microsoft Visual C++ compilers!"
 #error "Use this header only with Microsoft Visual C++ compilers!"
  ^

/usr/local/include/stdint.h:38:2: error: #error "Use this header only with Microsoft Visual C++ compilers!"
 #error "Use this header only with Microsoft Visual C++ compilers!"
  ^

其他一切都来自这两个错误。在标准位置清理您的系统,那些包含文件不应该存在。

我已经看到各种项目的报告,包括源代码存储库中的标题,人们将这些批量复制到标准位置。请参阅How do I use C headers from libgit2 without getting this error?当您将包含/ git2中的eveything复制到/ usr / include 时)和#error "Use this header only with Microsoft Visual C++ compilers" in CodeBlocks。然而,他们最终在你的系统上,他们不属于那里。