我尝试使用命令python ./get-pip.py -v
为python安装pip模块但是它返回了zlib不可用的错误:
[root@centos1 yum.repos.d]# python ./get-pip.py -v
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
当我尝试查询zlib时,我发现它已经存在:
[root@centos1 yum.repos.d]# rpm -qa | grep --color=auto -i 'zlib'
zlib-devel-1.2.3-7.el5
perl-Compress-Zlib-1.42-1.fc6
zlib-1.2.3-7.el5
perl-IO-Zlib-1.04-4.2.1
我尝试安装zlib-devel,但仍然遇到同样的错误:
zipimport.ZipImportError: can't decompress data; zlib not available
如何修复此问题并继续安装pip,因为我需要继续安装awscli。
答案 0 :(得分:0)
包python-pip
在epel repo中可用,通过运行yum install python-pip -y
来安装它,它也将解决所有依赖项
安装后你可以自我更新pip
pip install --upgrade pip
然后您可以安装awscli,pip install awscli
答案 1 :(得分:0)
手动安装“ zlib”后,再次重新安装python。
git clone https://github.com/madler/zlib.git
cd ${ZLIB_CLONED_DIR}
./configure --prefix=/usr/local
make
sudo make install
再次从源代码重建Python
cd ${PYTHON_SRC_CODE_DIR}
./configure --prefix=${PYTHON_HOME_DIR}
make
sudo make install