pip: zipimport.ZipImportError
When I run the command “python get-pip.py”,It alerts that as below:
Traceback (most recent call last):
File "../get-pip.py", line 17474, in <module>
main()
File "../get-pip.py", line 17466, in main
bootstrap(tmpdir=tmpdir)
File "../get-pip.py", line 17406, in bootstrap
import pip
zipimport.ZipImportError: can't decompress data; zlib not available
How to do that?Thank you!
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 24 (7 by maintainers)
1.Install the zlib the newest version 2.Then complie python again and run a line ./configure --prefix=/root/Python-2.7.8 --with-zlib-dir=/usr/local/lib
Thank you, I have made it!
@andy15703166 “1.Install the zlib the newest version” How to do this?
also
btw
What worked for me (@ vagrant oel65-i386-plain) was (not completely but at least killed zlib issue) was:
python2.7 get-pip.py
does not complain about zlib not being there (it complains now about SSL but that is not this story)Looks like your Python was built without zip support. Presumably it’s a custom build? You need that support for get-pip to work.
The error: zipimport.ZipImportError: can’t decompress data; zlib not available I meet the same problem while using the command “python get-pip.py”. python: 2.7.12 os: Centos 6.5
In the python source folder
./configure --prefix= --with-zlib-dir=/usr/local/lib
andmake && make install
Should be OK@hrdcore0x1 maybe you want
--with-libs
instead of--with-lib-dir
Make sure you have zlib (+development headers) package installed.
can you elaborate more the solution? i am facing the same problem and when trying the command ./configure --prefix=/root/Python-2.7.8 --with-zlib-dir=/usr/local/lib i get unrecognized command --with-lib-dir
As I guess you found out (just mentioning it here in case anyone later finds this issue when searching) you just need the relevant libraries available when building Python (I think it’s just zlib, but I’m not completely sure on that)
@NivaldoTeixeira directly inside the unzipped python sources folder. This is if you are building your python executable / installation from scratch. https://github.com/python/cpython/blob/master/configure is the file in SCM.