无法从源安装 python 3.6.3:目标“Programs/python.o”的配方失败
Posted
技术标签:
【中文标题】无法从源安装 python 3.6.3:目标“Programs/python.o”的配方失败【英文标题】:Failing to install python 3.6.3 from source: recipe for target 'Programs/python.o' failed 【发布时间】:2017-10-27 08:52:29 【问题描述】:我运行 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】:这不是 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?(当您将所有内容从 include/git2 复制到 /usr/include 时)和#error "Use this header only with Microsoft Visual C++ compilers" in CodeBlocks。但是它们最终出现在您的系统上,但它们不属于那里。
【讨论】:
这有帮助,谢谢!我完全删除了这两个文件,然后做了:$ sudo apt-get install build-essential checkinstall
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
并重新构建了 python以上是关于无法从源安装 python 3.6.3:目标“Programs/python.o”的配方失败的主要内容,如果未能解决你的问题,请参考以下文章
用python库openpyxl操作excel,从源excel表中提取信息复制到目标excel表中