安装/编译pylzma(LZMA Python绑定) [英] Installing/compiling pylzma (lzma python binding)

查看:4185
本文介绍了安装/编译pylzma(LZMA Python绑定)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经张贴了这个问题了作者的网站,但我想我会问这里。

I've already posted this question on the authors website, but I thought I might ask here as well.

我一直在试图安装在此设置pylzma:

I've been trying to install pylzma with this setup:


  • Windows 7的64

  • 的Python 2.6.6 64

  • AMD64位编译器从Windows Server 2003来SDK

  • 克隆git的回购的git://github.com/fancy$c$c/pylzma.git

通过一个简单的的easy_install pylzma 我得到这个:

With a simple easy_install pylzma I got this:

CL:命令行警告D9025:
  重写/ MD与/ MTpylzma.c
  SRC / pylzma / pylzma.c(85):警告
  C4244:'=':从转换
  Py_ssize_t'到'廉政',可能的损失
  数据

cl : Command line warning D9025 : overriding '/MD' with '/MT' pylzma.c src/pylzma/pylzma.c(85) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data

的src / pylzma / pylzma.c(102):错误
  C2275:'CSha256:非法使用这种
  类型作为前pression
          c:\\users\\xavier.lapointe\\appdata\\local\\temp\\easy_install-2mfkqu\\pylzma-0.4.3\\src\\pylzma../7zip/C/Sha256.h(18)
  :看到CSha256

src/pylzma/pylzma.c(102) : error C2275: 'CSha256' : illegal use of this type as an expression c:\users\xavier.lapointe\appdata\local\temp\easy_install-2mfkqu\pylzma-0.4.3\src\pylzma../7zip/C/Sha256.h(18) : see declaration of 'CSha256'

的src / pylzma / pylzma.c(102):错误
  C2146:语法错误:缺少;
  符前SHA

src/pylzma/pylzma.c(102) : error C2146: syntax error : missing ';' before identifier 'sha'

的src / pylzma / pylzma.c(102):错误
  C2065:SHA:未声明的标识符

src/pylzma/pylzma.c(102) : error C2065: 'sha' : undeclared identifier

的src / pylzma / pylzma.c(103):错误
  C2065:SHA:未声明的标识符

src/pylzma/pylzma.c(103) : error C2065: 'sha' : undeclared identifier

的src / pylzma / pylzma.c(103):警告
  C4133:功能:不兼容的类型
   - 从'诠释*'到'CSha256 *

src/pylzma/pylzma.c(103) : warning C4133: 'function' : incompatible types - from 'int *' to 'CSha256 *'

的src / pylzma / pylzma.c(104):错误
  C2143:语法错误:缺少;
  前型

src/pylzma/pylzma.c(104) : error C2143: syntax error : missing ';' before 'type'

的src / pylzma / pylzma.c(105):错误
  C2143:语法错误:缺少;
  前型

src/pylzma/pylzma.c(105) : error C2143: syntax error : missing ';' before 'type'

的src / pylzma / pylzma.c(106):错误
  C2143:语法错误:缺少;
  前型

src/pylzma/pylzma.c(106) : error C2143: syntax error : missing ';' before 'type'

的src / pylzma / pylzma.c(107):错误
  C2143:语法错误:缺少;
  前型

src/pylzma/pylzma.c(107) : error C2143: syntax error : missing ';' before 'type'

的src / pylzma / pylzma.c(108):错误
  C2065:'圆':未声明的标识符

src/pylzma/pylzma.c(108) : error C2065: 'round' : undeclared identifier

的src / pylzma / pylzma.c(108):错误
  C2065:'圆':未声明的标识符

src/pylzma/pylzma.c(108) : error C2065: 'round' : undeclared identifier

的src / pylzma / pylzma.c(108):错误
  C2065:'发':未声明
  标识符

src/pylzma/pylzma.c(108) : error C2065: 'rounds' : undeclared identifier

的src / pylzma / pylzma.c(108):错误
  C2065:'圆':未声明的标识符

src/pylzma/pylzma.c(108) : error C2065: 'round' : undeclared identifier

的src / pylzma / pylzma.c(109):错误
  C2065:SHA:未声明的标识符

src/pylzma/pylzma.c(109) : error C2065: 'sha' : undeclared identifier

的src / pylzma / pylzma.c(109):警告
  C4133:功能:不兼容的类型
   - 从'诠释*'到'CSha256 *

src/pylzma/pylzma.c(109) : warning C4133: 'function' : incompatible types - from 'int *' to 'CSha256 *'

的src / pylzma / pylzma.c(110):错误
  C2065:SHA:未声明的标识符

src/pylzma/pylzma.c(110) : error C2065: 'sha' : undeclared identifier

的src / pylzma / pylzma.c(110):警告
  C4133:功能:不兼容的类型
   - 从'诠释*'到'CSha256 *

src/pylzma/pylzma.c(110) : warning C4133: 'function' : incompatible types - from 'int *' to 'CSha256 *'

的src / pylzma / pylzma.c(111):错误
  C2065:SHA:未声明的标识符

src/pylzma/pylzma.c(111) : error C2065: 'sha' : undeclared identifier

的src / pylzma / pylzma.c(111):警告
  C4133:功能:不兼容的类型
   - 从'诠释*'到'CSha256 *

src/pylzma/pylzma.c(111) : warning C4133: 'function' : incompatible types - from 'int *' to 'CSha256 *'

的src / pylzma / pylzma.c(111):错误
  C2065:'温度':未声明的标识符

src/pylzma/pylzma.c(111) : error C2065: 'temp' : undeclared identifier

的src / pylzma / pylzma.c(112):错误
  C2065:'我':未声明的标识符

src/pylzma/pylzma.c(112) : error C2065: 'i' : undeclared identifier

的src / pylzma / pylzma.c(112):错误
  C2065:'我':未声明的标识符

src/pylzma/pylzma.c(112) : error C2065: 'i' : undeclared identifier

的src / pylzma / pylzma.c(112):错误
  C2065:'我':未声明的标识符

src/pylzma/pylzma.c(112) : error C2065: 'i' : undeclared identifier

的src / pylzma / pylzma.c(113):错误
  C2065:'温度':未声明的标识符

src/pylzma/pylzma.c(113) : error C2065: 'temp' : undeclared identifier

的src / pylzma / pylzma.c(113):错误
  C2065:'我':未声明的标识符

src/pylzma/pylzma.c(113) : error C2065: 'i' : undeclared identifier

的src / pylzma / pylzma.c(113):错误
  C2109:标要求数组或
  指针类型

src/pylzma/pylzma.c(113) : error C2109: subscript requires array or pointer type

的src / pylzma / pylzma.c(116):错误
  C2065:SHA:未声明的标识符

src/pylzma/pylzma.c(116) : error C2065: 'sha' : undeclared identifier

的src / pylzma / pylzma.c(116):警告
  C4133:功能:不兼容的类型
   - 从'诠释*'到'CSha256 *

src/pylzma/pylzma.c(116) : warning C4133: 'function' : incompatible types - from 'int *' to 'CSha256 *'

错误:安装脚本退出,出现错误:
  命令'C:\\ Program Files文件
  (x86)的\\微软的Visual Studio
  9.0 \\ VC \\ BIN \\ AMD64 \\ cl.exe时'与退出状态失败2

error: Setup script exited with error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe"' failed with exit status 2

然后谷歌搜索后,我想这是对编译器(C90 C99 VS),一些人建议改变.c扩展到.CPP。所以,我这样做,并相应地改变了setup.py(主要是文件名)。

Then after googling I figured it was about the compiler (c90 vs c99), some people suggested to change the .c extension to .cpp. So I did this and changed the setup.py accordingly (mostly files name).

那么成功,它CpuArch.c(PP)一些调整和其他文件其中有语法错误之后编译。

Then success, it compiles after a few tweaks in CpuArch.c(pp) and another file which had syntax errors.

事情现在是连接呛:

C:\\ Program Files文件(x86)的\\微软
  视觉工作室
  9.0 \\ VC \\ BIN \\ AMD64 \\ LINK.EXE / DLL / NOLOGO /增量:NO
  /LIBPATH:C:\\dev\\pylzma\\build\\temp.win-amd64-2.6\\Release\\src\\pylzma
  / LIBPATH:C:\\ Python26 \\库
  / LIBPATH:C:\\ Python26 \\ PCbuild \\ AMD64
  USER32.LIB oleaut32.lib
  / EXPORT:initpylzma
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma / pylzma.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma / pylzma_decom pressobj.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma / pylzma_com pressfile.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma / pylzma_decom press.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma / pylzma_com press.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma / pylzma_streams.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma / pylzma_aes.obj建设\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma / pylzma_decom press_compat.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma / pylzma_decom pressobj_compat.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src \\ SDK \\ LzFind.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src \\ SDK \\ LzmaDec.obj建设\\ temp.win-amd64-2.6 \\发布的\\ src \\ SDK \\ LzmaEnc.obj建设\\ temp.win-amd64-2.6 \\发布\\ SRC \\ 7zip的\\ C \\ CpuArch.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src \\ 7zip的\\ C \\ Aes.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src \\ 7zip的\\ C \\ AesOpt.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src \\ 7zip的\\ C \\ Sha256.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src \\ COMPAT \\ LzmaCompatDe code.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / SDK / LzFindMt.obj
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / SDK / Threads.obj /OUT:build\\lib.win-amd64-2.6\\pylzma.pyd
  /IMPLIB:build\\temp.win-amd64-2.6\\Release\\src/pylzma\\pylzma.lib
  /MANIFESTFILE:build\\temp.win-amd64-2.6\\Release\\src/pylzma\\pylzma.pyd.manifest

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\dev\pylzma\build\temp.win-amd64-2.6\Release\src\pylzma /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild\amd64 user32.lib oleaut32.lib /EXPORT:initpylzma build\temp.win-amd64-2.6\Release\src/pylzma/pylzma.obj build\temp.win-amd64-2.6\Release\src/pylzma/pylzma_decompressobj.obj build\temp.win-amd64-2.6\Release\src/pylzma/pylzma_compressfile.obj build\temp.win-amd64-2.6\Release\src/pylzma/pylzma_decompress.obj build\temp.win-amd64-2.6\Release\src/pylzma/pylzma_compress.obj build\temp.win-amd64-2.6\Release\src/pylzma/pylzma_streams.obj build\temp.win-amd64-2.6\Release\src/pylzma/pylzma_aes.obj build\temp.win-amd64-2.6\Release\src/pylzma/pylzma_decompress_compat.obj build\temp.win-amd64-2.6\Release\src/pylzma/pylzma_decompressobj_compat.obj build\temp.win-amd64-2.6\Release\src\sdk\LzFind.obj build\temp.win-amd64-2.6\Release\src\sdk\LzmaDec.obj build\temp.win-amd64-2.6\Release\src\sdk\LzmaEnc.obj build\temp.win-amd64-2.6\Release\src\7zip\C\CpuArch.obj build\temp.win-amd64-2.6\Release\src\7zip\C\Aes.obj build\temp.win-amd64-2.6\Release\src\7zip\C\AesOpt.obj build\temp.win-amd64-2.6\Release\src\7zip\C\Sha256.obj build\temp.win-amd64-2.6\Release\src\compat\LzmaCompatDecode.obj build\temp.win-amd64-2.6\Release\src/sdk/LzFindMt.obj build\temp.win-amd64-2.6\Release\src/sdk/Threads.obj /OUT:build\lib.win-amd64-2.6\pylzma.pyd /IMPLIB:build\temp.win-amd64-2.6\Release\src/pylzma\pylzma.lib /MANIFESTFILE:build\temp.win-amd64-2.6\Release\src/pylzma\pylzma.pyd.manifest

pylzma.obj:警告LNK4197:出口
  initpylzma'指定多次;
  使用第一个规范创建
  图书馆
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma \\ pylzma.lib
  和对象
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma \\ pylzma.exp

pylzma.obj : warning LNK4197: export 'initpylzma' specified multiple times; using first specification Creating library build\temp.win-amd64-2.6\Release\src/pylzma\pylzma.lib and object build\temp.win-amd64-2.6\Release\src/pylzma\pylzma.exp

pylzma.obj:错误LNK2001:无法解析
  外部符号字符常量* const的
  doc_decom preSS
  (?doc_decom $ P $ @@ PSS 3QBDB)

pylzma.obj : error LNK2001: unresolved external symbol "char const * const doc_decompress" (?doc_decompress@@3QBDB)

pylzma.obj:错误LNK2001:无法解析
  外部符号结构_object *
  __cdecl pylzma_decom preSS(结构_object *,结构* _object)(?pylzma_decom $ P $ @@ PSS @@ YAPEAU_object @ PEAU1 0 @ Z)

pylzma.obj : error LNK2001: unresolved external symbol "struct _object * __cdecl pylzma_decompress(struct _object *,struct _object *)" (?pylzma_decompress@@YAPEAU_object@@PEAU1@0@Z)

pylzma.obj:错误LNK2001:无法解析
  外部符号字符常量* const的
  doc_com preSS(?doc_com $ P $ @@ PSS 3QBDB)

pylzma.obj : error LNK2001: unresolved external symbol "char const * const doc_compress" (?doc_compress@@3QBDB)

Aes.obj:错误LNK2019:​​无法解析
  外部符号无效__cdecl
  AesCtr_ code_Intel(unsigned int类型
  *,无符号字符*,无符号__int64)(?AesCtr_ code_Intel @@ YAXPEAIPEAE_K @ Z)
  在功能上AesGenTables引用

Aes.obj : error LNK2019: unresolved external symbol "void __cdecl AesCtr_Code_Intel(unsigned int *,unsigned char *,unsigned __int64)" (?AesCtr_Code_Intel@@YAXPEAIPEAE_K@Z) referenced in function AesGenTables

Aes.obj:错误LNK2019:​​无法解析
  外部符号无效__cdecl
  AesCbc_De code_Intel(unsigned int类型
  *,无符号字符*,无符号__int64)(?AesCbc_De code_Intel @@ YAXPEAIPEAE_K @ Z)
  在功能上AesGenTables引用

Aes.obj : error LNK2019: unresolved external symbol "void __cdecl AesCbc_Decode_Intel(unsigned int *,unsigned char *,unsigned __int64)" (?AesCbc_Decode_Intel@@YAXPEAIPEAE_K@Z) referenced in function AesGenTables

Aes.obj:错误LNK2019:​​无法解析
  外部符号无效__cdecl
  AesCbc_En code_Intel(unsigned int类型
  *,无符号字符*,无符号__int64)(?AesCbc_En code_Intel @@ YAXPEAIPEAE_K @ Z)
  在功能上AesGenTables引用

Aes.obj : error LNK2019: unresolved external symbol "void __cdecl AesCbc_Encode_Intel(unsigned int *,unsigned char *,unsigned __int64)" (?AesCbc_Encode_Intel@@YAXPEAIPEAE_K@Z) referenced in function AesGenTables

AesOpt.obj:错误LNK2019:​​无法解析
  外部符号_mm_aesenclast_si128
  在函数引用无效__cdecl
  AesCbc_En code_Intel(工会__m128i
  *,工会__m128i *,无符号__int64)(?AesCbc_En code_Intel @@ YAXPEAT__m128i @@ 0_K @ Z)

AesOpt.obj : error LNK2019: unresolved external symbol _mm_aesenclast_si128 referenced in function "void __cdecl AesCbc_Encode_Intel(union __m128i *,union __m128i *,unsigned __int64)" (?AesCbc_Encode_Intel@@YAXPEAT__m128i@@0_K@Z)

AesOpt.obj:错误LNK2019:​​无法解析
  外部符号_mm_aesenc_si128
  在函数引用无效__cdecl
  AesCbc_En code_Intel(工会__m128i
  *,工会__m128i *,无符号__int64)(?AesCbc_En code_Intel @@ YAXPEAT__m128i @@ 0_K @ Z)

AesOpt.obj : error LNK2019: unresolved external symbol _mm_aesenc_si128 referenced in function "void __cdecl AesCbc_Encode_Intel(union __m128i *,union __m128i *,unsigned __int64)" (?AesCbc_Encode_Intel@@YAXPEAT__m128i@@0_K@Z)

AesOpt.obj:错误LNK2019:​​无法解析
  外部符号_mm_aesdeclast_si128
  在函数引用无效__cdecl
  AesCbc_De code_Intel(工会__m128i
  *,工会__m128i *,无符号__int64)(?AesCbc_De code_Intel @@ YAXPEAT__m128i @@ 0_K @ Z)

AesOpt.obj : error LNK2019: unresolved external symbol _mm_aesdeclast_si128 referenced in function "void __cdecl AesCbc_Decode_Intel(union __m128i *,union __m128i *,unsigned __int64)" (?AesCbc_Decode_Intel@@YAXPEAT__m128i@@0_K@Z)

AesOpt.obj:错误LNK2019:​​无法解析
  外部符号_mm_aesdec_si128
  在函数引用无效__cdecl
  AesCbc_De code_Intel(工会__m128i
  *,工会__m128i *,无符号__int64)(?AesCbc_De code_Intel @@ YAXPEAT__m128i @@ 0_K @ Z)
  建立\\ lib.win-amd64-2.6 \\ pylzma.pyd:
  致命错误LNK1120:10未解决
  外部

AesOpt.obj : error LNK2019: unresolved external symbol _mm_aesdec_si128 referenced in function "void __cdecl AesCbc_Decode_Intel(union __m128i *,union __m128i *,unsigned __int64)" (?AesCbc_Decode_Intel@@YAXPEAT__m128i@@0_K@Z) build\lib.win-amd64-2.6\pylzma.pyd : fatal error LNK1120: 10 unresolved externals

错误:命令'C:\\ Program Files文件
  (x86)的\\微软的Visual Studio
  9.0 \\ VC \\ BIN \\ AMD64 \\ LINK.EXE'与退出状态没有1120

error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe"' failed with exit status 1120

现在我有一个困难时期试图找出这些链接的问题是什么,甚至与MSDN文档(约接头错误)。可能是由于我缺乏与C / C ++的知识。

Now I've a hard time trying to figure out what these linker issues are, even with the msdn doc (about linkers error). Probably due to my lack of knowledge with C/C++.

所以基本上我的问题(S)是:

So basically my question(s) are:


  • 有没有办法解决这些问题的链接?

  • 我错了那些文件从.C重命名为.CPP。如果是的话,是有可能编译为与MSVC AMD64编译.C?

修改
没有得到太多的答案,所以我想我会添加一些问题:

EDIT Haven't got much answer, so I think I'll add some questions:


  • 什么是你的做法,当涉及到链接程序错误?

  • What's your approach when it comes to linker error?

有没有我可以按照帮助自己找到在网上回答(这个的 MSDN链接错误)?

Is there any logic I can follow to help myself find answers over the web (combined with this MSDN linker errors)?

自从我看到很多人成功编译它为32位系统,是有可能,它编译于64位很好,但是当它涉及到,因为建筑类型的连接失败?

Since I've seen many people compile it successfully for 32 bit system, is it possible that it compiles fine in 64bit, but fails when it comes to linking because of the architecture type?

我在寻找更多的提示,可以帮助比一个完全工作的答案。

I'm looking more for hints that might help than a fully working answer.

非常感谢您的帮助(:

推荐答案

我已经安装了pylzma尝试了这一点我自己。对于Python 2.6它建立罚款与MinGW的,但MSVC编译器扼流圈python2.4-2.7。让我们先来看看错误:

I have installed pylzma to try this out myself. For python 2.6 it builds fine with mingw, but msvc compiler chokes for python2.4-2.7. Let's see errors first:

的src / pylzma / pylzma.c(102):错误
  C2275:'CSha256:非法使用这种
  类型作为前pression
  c:\\users\\xavier.lapointe\\appdata\\local\\temp\\easy_install-2mfkqu\\pylzma-0.4.3\\src\\pylzma../7zip/C/Sha256.h(18) :看到CSha256

src/pylzma/pylzma.c(102) : error C2275: 'CSha256' : illegal use of this type as an expression c:\users\xavier.lapointe\appdata\local\temp\easy_install-2mfkqu\pylzma-0.4.3\src\pylzma../7zip/C/Sha256.h(18) : see declaration of 'CSha256'

code是:

} else {
    Py_BEGIN_ALLOW_THREADS
    Sha256_Init(&sha);
    CSha256 sha;
    long round;
    int i;
    long rounds = (long) 1 << cycles;
    unsigned char temp[8] = { 0,0,0,0,0,0,0,0 };
    for (round = 0; round < rounds; round++) {

这显然是无效的C,因为C它不允许申报后,code变量。当您重命名的.c到.CPP你避免这种错误,因为C ++允许这种(和MinGW支持此对C显然)。但切换到C ++导致名称重整和链接错误。要解决这些,你可以把的externC{...} 周围所有的code。

这是更好地修复的src / pylzma / pylzma.c htough和修复是微不足道的 - 移动Py_BEGIN_ALLOW_THREADS和Sha256_Init(安培; SHA);变量声明后:

It's better to fix src/pylzma/pylzma.c htough and the fix is trivial - move Py_BEGIN_ALLOW_THREADS and Sha256_Init(&sha); after variable declarations:

} else {
    CSha256 sha;
    long round;
    int i;
    long rounds = (long) 1 << cycles;
    unsigned char temp[8] = { 0,0,0,0,0,0,0,0 };
    Py_BEGIN_ALLOW_THREADS
    Sha256_Init(&sha);
    for (round = 0; round < rounds; round++) {

现在pylzma编译罚款,但却无法运行链接后表现的工具:

Now pylzma compiles fine but fails to run manifest tool after linking:

创建库
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma \\ pylzma.lib
  和O bject
  建立\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma \\ pylzma.exp
  C:\\ Program Files文件\\微软
  的SDK \\ WINDOWS \\ 7.0 \\ BIN \\ 64 \\ mt.exe
  -nologo -manifest BU ILD \\ temp.win-amd64-2.6 \\发布的\\ src / pylzma \\ pylzma.pyd.manifest
  -outputresource:BU ILD \\ lib.win-amd64-2.6 \\ pylzma.pyd; 2

Creating library build\temp.win-amd64-2.6\Release\src/pylzma\pylzma.lib and o bject build\temp.win-amd64-2.6\Release\src/pylzma\pylzma.exp C:\Program Files\Microsoft SDKs\Windows\v7.0\bin\x64\mt.exe -nologo -manifest bu ild\temp.win-amd64-2.6\Release\src/pylzma\pylzma.pyd.manifest -outputresource:bu ild\lib.win-amd64-2.6\pylzma.pyd;2

打造\\ temp.win-amd64-2.6 \\发布的\\ src / pylzma \\ pylzma.pyd.manifest
  :一般错误c1010070:无法
  加载并解析清单。该
  系统无法找到文件
  指定。错误:命令'mt.exe
  与退出状态失败31

build\temp.win-amd64-2.6\Release\src/pylzma\pylzma.pyd.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. error: command 'mt.exe' failed with exit status 31

展望build目录显示,没有pylzma.pyd.manifest那里虽然它从LINK.EXE有/输出清单看到:...开关。对于链接没有创造出明显的快速谷歌上搜索发现 http://bugs.python.org/issue4431 它的解释,当使用/ MT开关清单还没有生成和解决方案是增加/舱单连接器选项。好吧,让我们编辑pylzma的setup.py以添加链接器标志MSVC编译:

Looking in build directory reveals that there is no pylzma.pyd.manifest there though it's seen from output that link.exe has /MANIFEST:... switch. Quick googling for "link didn't create manifest" finds http://bugs.python.org/issue4431 where it's explained that when using /MT switch manifest doesn't get created and the solution is to add /MANIFEST to linker flags. Alright, let's edit pylzma's setup.py to add that linker flag for MSVC compiler:

    if isinstance(self.compiler, MSVCCompiler):
        # set flags only available when using MSVC
        ext.extra_link_args.append('/MANIFEST') # force linker to create manifest
        if COMPILE_DEBUG:
            ext.extra_compile_args.append('/Zi')
            ext.extra_compile_args.append('/MTd')
            ext.extra_link_args.append('/DEBUG')
        else:
            ext.extra_compile_args.append('/MT')

瞧,pylzma用MSVC精细现在的基础之上。我已经测试使用Python 2.4-2.7 32位和2.6-2.7 64位:

Voila, pylzma builds with MSVC fine now. I have tested building with python 2.4-2.7 32-bit and 2.6-2.7 64-bit:

08.02.2011  10:08            71 844 pylzma-0.4.3dev-py2.4-win32.egg
08.02.2011  10:09            71 480 pylzma-0.4.3dev-py2.5-win32.egg
08.02.2011  10:07            79 358 pylzma-0.4.3dev-py2.6-win-amd64.egg
08.02.2011  10:09            75 637 pylzma-0.4.3dev-py2.6-win32.egg
08.02.2011  10:08            79 259 pylzma-0.4.3dev-py2.7-win-amd64.egg
08.02.2011  10:09            75 540 pylzma-0.4.3dev-py2.7-win32.egg
               6 File(s)        453 118 bytes

作为一般方法的任何错误 - 它可能需要一些知识和经验,了解什么是他们背后

As of general approach to any errors - it probably requires some knowledge and experience to understand what's behind them.

这篇关于安装/编译pylzma(LZMA Python绑定)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆