Python3:没有 gzip 或 zlib?

发布于 2024-10-01 12:43:19 字数 998 浏览 8 评论 0原文

该模块现在有其他名称吗?我似乎找不到任何信息表明该模块已被弃用或完全删除。 (这会让我更加困惑)

有人知道这去哪儿了吗?

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

更新:我在使用 Python-3.1.2/Modules/zlib/ChangeLog 的源包中找到了这个 最后一次更改是在 2005 年,并且没有提及任何重要内容。

                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]

[已解决] http://www.1stbyte.com/ 2005/06/26/配置和编译-python-with-zlib/

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/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多情癖 2024-10-08 12:43:19

(通过在问题中编辑 URL 来回答。转换为社区 wiki 答案。请参阅 没有答案的问题,但问题在评论中得到解决(或在聊天中扩展)

OP 写道:

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

SO 不赞成仅使用 URL 答案,并且从 GregTheGeek 转录博客是不合适的在那个网站上。然而,总而言之,必要的步骤是:

  1. 安装适当的 Zlib-dev 软件包。例如,在 Ubuntu 上,它称为 zlib1g-dev。这将提供 zlib.h 包含文件。
  2. 编译 python 源代码后,运行配置脚本: ./configure –with-zlib=/usr/include
  3. 现在 makemake install 应该可以工作。

(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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文