如何知道libpython27.a是32位还是64位?
我有一个如何知道libpython27.a是32位还是64位?,python,static-libraries,32bit-64bit,platform,Python,Static Libraries,32bit 64bit,Platform,我有一个libpython27.a文件:如何知道它是32位还是64位,在Windows 7 x64上?在终端/命令行中启动Python解释器时,您可能还会看到一行,如: Python 2.7.2(默认值,2011年6月12日,14:24:46)[MSC v.1500 64位 (AMD64)]在win32上 其中[MSC v.1500 64位(AMD64)]表示64位Python 或 尝试使用ctypes获取空指针的大小: import ctypes print ctypes.sizeof(cty
libpython27.a
文件:如何知道它是32位还是64位,在Windows 7 x64上?在终端/命令行中启动Python解释器时,您可能还会看到一行,如:
Python 2.7.2(默认值,2011年6月12日,14:24:46)[MSC v.1500 64位
(AMD64)]在win32上
其中[MSC v.1500 64位(AMD64)]表示64位Python
或
尝试使用ctypes获取空指针的大小:
import ctypes
print ctypes.sizeof(ctypes.c_voidp)
32位为4,64位为8。请尝试
dumpbin/headers“libpython27.a”
。()
输出将包含
文件头值
14C机器(x86)
或
文件头值
8664机器(x64)
请注意,如果您收到如下错误消息:
E:\temp>dumpbin /headers "libpython27.a"
LINK: extra operand `libpython27.a'
Try `LINK --help' for more information.
这意味着在搜索路径的某个地方有一个GNU链接实用程序的副本。请确保使用正确的<代码>链接.exe < />(例如,在<代码> C中提供的程序文件(x86)\公用文件\微软\Visual C++,用于Python \\\\VC\bin < /COD>)。它还需要mspdb80.dll
,它位于同一文件夹或路径中的某个位置,否则您将收到错误消息:
在Linux上,您可以使用:
objdump-a libpython27.a | grep“文件格式”
例如:
f@f-VirtualBox:/media/code$ objdump -a libpython27.a|grep 'file format'
dywkt.o: file format pe-i386
dywkh.o: file format pe-i386
dywks01051.o: file format pe-i386
dywks01050.o: file format pe-i386
dywks01049.o: file format pe-i386
dywks01048.o: file format pe-i386
[...]