zipimport.ZipImportError: 无法解压数据;zlib 不可用

Fla*_*air 94 rhel python pip python3

在 RHEL 6.6 上,我从源代码安装了 Python 3.5.1。我正在尝试通过 get-pip.py 安装 pip3,但我得到了

Traceback (most recent call last):
  File "get-pip.py", line 19177, in <module>
    main()
  File "get-pip.py", line 194, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
Run Code Online (Sandbox Code Playgroud)

它适用于安装的 Python 2.6.6。我在网上寻找答案,但似乎找不到适合我的答案。

编辑: yum search zlib

jzlib.i686 : JZlib re-implementation of zlib in pure Java
perl-Compress-Raw-Zlib.i686 : Low-Level Interface to the zlib compression library
perl-Compress-Zlib.i686 : A module providing Perl interfaces to the zlib compression library
perl-IO-Zlib.i686 : Perl IO:: style interface to Compress::Zlib
zlib.i686 : The zlib compression and decompression library
zlib-debuginfo.i686 : Debug information for package zlib
zlib-devel.i686 : Header files and libraries for Zlib development
perl-IO-Compress-Zlib.i686 : Perl interface to allow reading and writing of gzip and zip data

  Name and summary matches only, use "search all" for everything.
Run Code Online (Sandbox Code Playgroud)

jmu*_*sch 140

Ubuntu 16.10+和 Python 3.7 开发

sudo apt-get install zlib1g-dev
Run Code Online (Sandbox Code Playgroud)

注意:我只把它放在这里是因为它是错误的最高搜索结果,但这解决了我的问题。

更新:ubuntu 14.04LTS 和 4.1+ 的基本内核也是如此

  • 谢谢!它帮助我解决了在 Ubuntu 18.04 上安装 3.7.1 的问题 (4认同)
  • 帮助解决了 Ubuntu 20 上的 python3+ 问题 (2认同)

Knu*_*sen 46


解决办法是:# yum install zlib-devel



  • 我试过了。它说`设置安装进程rhel6_latest | 1.9 kB 00:00 包 zlib-devel-1.2.3-29.el6.i686 已经安装和最新版本 无事可做`,但我仍然收到 zipimport 错误。 (5认同)

小智 8

只需复制粘贴此代码

CFLAGS="-I$(brew --prefix readline)/include -I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" \
LDFLAGS="-L$(brew --prefix readline)/lib -L$(brew --prefix openssl)/lib" \
PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs2 \
pyenv install -v 3.6.0
Run Code Online (Sandbox Code Playgroud)


ARe*_*ddy 3

您没有解压工具,您应该安装zlib

更新答案

首先检查是否已安装

yum list python-gzipstream

如果没有,则运行以下命令进行安装

yum install python-gzipstream.noarch

我的系统上安装了这个

 yum list python-gzipstream
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.webwerks.com
 * epel: ftp.kddilabs.jp
 * extras: centos.webwerks.com
 * updates: mirror.nbrc.ac.in
Available Packages
python-gzipstream.noarch                                                                1.4.3-1.el6                                                                 epel
Run Code Online (Sandbox Code Playgroud)

  • 我运行了“yum install zlib”。我知道我已经有了最新版本。我仍然遇到同样的错误。 (4认同)