【问题标题】:Error when installing python pyminizip module and zlib.dll安装 python pyminizip 模块和 zlib.dll 时出错
【发布时间】:2017-03-01 10:28:05
【问题描述】:

我正在尝试在我的 PC 上安装 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 -> 相同的结果

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

【问题讨论】:

标签: python system zlib


【解决方案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子文件夹

现在您应该可以使用“python setup.py install”进行安装了

【讨论】:

    猜你喜欢
    • 2011-06-06
    • 2015-07-16
    • 2014-10-13
    • 2020-04-16
    • 2016-11-29
    • 1970-01-01
    • 1970-01-01
    • 2012-01-04
    相关资源
    最近更新 更多