在python 2.7.9上安装pylzma时出错

时间:2015-05-22 15:38:07

标签: python 7zip

我正在尝试通过python 2.7.9上的pip安装Pylzma,我收到以下错误:

memoryCache(Cache cache)

这是调试日志:

    C:\Python27\Scripts>pip.exe install pylzma
Downloading/unpacking pylzma
  Running setup.py (path:c:\users\username\appdata\local\temp\pip_build_username\pylzma\setup.py) egg_info for package pylzma

    warning: no files found matching '*.py' under directory 'test'
    warning: no files found matching '*.7z' under directory 'test'
    no previously-included directories found matching 'src\sdk.orig'
Installing collected packages: pylzma
  Running setup.py install for pylzma
    adding support for multithreaded compression
    building 'pylzma' extension
    C:\Users\username\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DWITH_COMPAT=1 -DPYLZMA_VERSION="0.4.6" -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\Python27\include -IC:\Python27\PC /Tcsrc/pylzma/pylzma.c /Fobuild\temp.win32-2.7\Release\src/pylzma/pylzma.obj /MT
    cl : Command line warning D9025 : overriding '/MD' with '/MT'
    pylzma.c
    src/pylzma/pylzma.c(284) : error C2440: 'function' : cannot convert from 'double' to 'const char *'
    src/pylzma/pylzma.c(284) : warning C4024: 'PyModule_AddStringConstant' : different types for formal and actual parameter 3
    src/pylzma/pylzma.c(284) : error C2143: syntax error : missing ')' before 'constant'
    src/pylzma/pylzma.c(284) : error C2059: syntax error : ')'
    error: command 'C:\\Users\\username\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
    Complete output from command C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\username\\appdata\\local\\temp\\pip_build_username\\pylzma\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\username\appdata\local\temp\pip-4onyx_-record\install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build\lib.win32-2.7

copying py7zlib.py -> build\lib.win32-2.7

running build_ext

adding support for multithreaded compression

building 'pylzma' extension

creating build\temp.win32-2.7

creating build\temp.win32-2.7\Release

creating build\temp.win32-2.7\Release\src

creating build\temp.win32-2.7\Release\src\pylzma

creating build\temp.win32-2.7\Release\src\sdk

creating build\temp.win32-2.7\Release\src\7zip

creating build\temp.win32-2.7\Release\src\7zip\C

creating build\temp.win32-2.7\Release\src\compat

C:\Users\username\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DWITH_COMPAT=1 -DPYLZMA_VERSION="0.4.6" -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\Python27\include -IC:\Python27\PC /Tcsrc/pylzma/pylzma.c /Fobuild\temp.win32-2.7\Release\src/pylzma/pylzma.obj /MT

cl : Command line warning D9025 : overriding '/MD' with '/MT'

pylzma.c

src/pylzma/pylzma.c(284) : error C2440: 'function' : cannot convert from 'double' to 'const char *'

src/pylzma/pylzma.c(284) : warning C4024: 'PyModule_AddStringConstant' : different types for formal and actual parameter 3

src/pylzma/pylzma.c(284) : error C2143: syntax error : missing ')' before 'constant'

src/pylzma/pylzma.c(284) : error C2059: syntax error : ')'

error: command 'C:\\Users\\username\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

----------------------------------------
Cleaning up...
Command C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\username\\appdata\\local\\temp\\pip_build_username\\pylzma\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\username\appdata\local\temp\pip-4onyx_-record\install-record.txt --single-version-externally-managed --compile failed with error code 1 in c:\users\username\appdata\local\temp\pip_build_username\pylzma
Storing debug log for failure in C:\Users\username\pip\pip.log

我已经确定我正在以管理员身份运行提示,我重新启动并且我用Google搜索,但我找不到任何内容。有什么建议吗?

2 个答案:

答案 0 :(得分:0)

我也得到了编译错误。希望很快得到修复。在此期间,可以使用二进制包,请参阅:How pip install pylzma on windows 7 x64 , python 2.7

答案 1 :(得分:0)

此错误是一个记录在案的错误,已经解决并在问题#29中推送到pip repo。 Pip安装应该再次使用新版本。

https://github.com/fancycode/pylzma/issues/29#issuecomment-125749627