Python3: no gzip or zlib?

ぃ、小莉子 提交于 2019-12-10 19:15:41

问题


is this module named something else now? I can't seem to find any info saying that this module was deprecated or dropped completely. (which would confuse me further)

Anyone know where this went?

Python 3.1.2 (r312:79147, May 20 2010, 09:09:30)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gzip
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.1/gzip.py", line 9, in 
    import zlib
ImportError: No module named zlib

UPDATE: I found this in the source bundle i used Python-3.1.2/Modules/zlib/ChangeLog The last change was in 2005 and it doesn't mention anything telling.

                ChangeLog file for zlib

Changes in 1.2.3 (18 July 2005)
- Apply security vulnerability fixes to contrib/infback9 as well
- Clean up some text files (carriage returns, trailing space)
- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]

[SOLVED] http://www.1stbyte.com/2005/06/26/configure-and-compile-python-with-zlib/


回答1:


(Answered by editing a URL into the question. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

[SOLVED] http://www.1stbyte.com/2005/06/26/configure-and-compile-python-with-zlib/

SO deprecates URL only answers, and it would be inappropriate to transcribe the blog from GregTheGeek on that site. However, in summary, the steps necessary are:

  1. Install the appropriate Zlib-dev package. For example on Ubuntu it is called zlib1g-dev. This will provide the zlib.h include file.
  2. After compiling your python sources run the configure script: ./configure –with-zlib=/usr/include
  3. Now make and make install should work.


来源:https://stackoverflow.com/questions/4134708/python3-no-gzip-or-zlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!