安装python pyminizip模块和zlib.dll时出错

时间:2017-03-01 10:28:06

标签: python system zlib

我正在尝试在我的电脑上安装python pyminizip模块,但我有一个错误的错误:

C:\Python27\Scripts>pip install pyminizip
Collecting pyminizip
  Using cached pyminizip-0.2.1.tar.gz
Installing collected packages: pyminizip
  Running setup.py install for pyminizip ... error
    Complete output from command c:\python27\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\andrei~1.gug\\appdata\\local\\temp\\pip-build-mb
aaft\\pyminizip\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.re
ad().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" inst
all --record c:\users\andrei~1.gug\appdata\local\temp\pip-9hqnfh-record\install-
record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'pyminizip' extension
    creating build
    creating build\temp.win32-2.7
    creating build\temp.win32-2.7\Release
    creating build\temp.win32-2.7\Release\src
    C:\Users\Andrei-Cristian.GUGI\AppData\Local\Programs\Common\Microsoft\Visual
 C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrc -Ic
:\python27\include -Ic:\python27\PC /Tcsrc/py_minizip.c /Fobuild\temp.win32-2.7\
Release\src/py_minizip.obj
    py_minizip.c
    c:\users\andrei-cristian.gugi\appdata\local\temp\pip-build-mbaaft\pyminizip\
src\zip.h(43) : fatal error C1083: Cannot open include file: 'zlib.h': No such f
ile or directory
    error: command 'C:\\Users\\Andrei-Cristian.GUGI\\AppData\\Local\\Programs\\C
ommon\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit
status 2

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\andrei~1.gug\\appdata\\local\\temp\\pip-build-mbaaft\\pyminizip\\setup.p
y';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n
');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\an
drei~1.gug\appdata\local\temp\pip-9hqnfh-record\install-record.txt --single-vers
ion-externally-managed --compile" failed with error code 1 in c:\users\andrei~1.
gug\appdata\local\temp\pip-build-mbaaft\pyminizip\

我还尝试安装zlib.dll - >从互联网复制到C:\ Windows \ SysWOW64 - >相同的结果

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

首先从pypi和 zlib 源(http://zlib.net/zlib1211.zip)获取pyminizip的副本 在那之后你需要做的一些事情:

  1. 使用Visual Studio编译zlibvc解决方案文件(以下是http://www.tannerhelland.com/5076/compile-zlib-winapi-wapi-stdcall/) - 确保编译正确的平台(x86 / x64 !!)
  2. 复制已创建的' zlibstat.lib'从ZLibStatRelease子文件夹到python包安装文件夹(setup.py旁边)并将其重命名为' zlib.lib'

  3. 将zlib文件夹中的所有zlib源文件(makefile除外)复制到python包src子文件夹中,包括win32子文件夹

  4. 现在你应该很高兴使用' python setup.py install'

    进行安装