wget https://bootstrap.pypa.io/get-pip.py # python3
error:
[[email protected] ~]$ https://bootstrap.pypa.io/get-pip.py [[email protected] ~]$ sudo python get-pip.py
The error message “zipimport.ZipImportError: can’t decompress data; zlib not available”
It seems that the zlib library is missing and needs to be installed before execution.
Problem solved
1 | [[email protected] ~]$ sudo yum install zlib |
After the installation was completed, we found that it still reported an error, and a Google search revealed that we needed to install zlib-dev
So we install the zlib library again
1 | [[email protected] ~]$ sudo yum install zlib* |
This time the installation should be OK, but the result is disappointing, it still gives the same error.
But we have already installed the zlib library, why does it still give us an error?
We need to recompile and install python
Before recompiling, we need to modify the Modules/Setup.dist file in the installation source file to change the
1 | #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz |
The comment on this line is removed and becomes
1 | zlib zlibmodule.c -I$(prefix) /include -L$(exec_prefix) /lib -lz |
Then compile and install it again (execute the following command in Python’s installation source directory)
1 | [[email protected] ~]$ make && make install |
Reinstallation completed
Execute.
1 | [[email protected] ~]$ sudo python get-pip.py |
Install pip successfully!
Similar Posts:
- [Solved] python Install pip Error: zipimport.ZipImportError: can’t decompress data; zlib not available
- [Solved] pip and setuptools upgrade Error: Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-fH0Feg/pip/
- zlib.h:no such file or directory
- /usr/bin/ld: cannot find -lz
- [Solved] Python virtual environment install Error: returned non zero exit status 1
- How to Solve ModuleNotFoundError: No module named ‘pip._internal’
- Error in installing Python 3.7 in CentOS 7.6 zipimport.ZipImportError : can’t decompress data; zlib not available
- [PIP command error] after upgrading the PIP in Ubuntu 16.04, execute the PIP command to report an error sys.stderr.write (F “error: {exc}”)
- Python compiles and installs under Linux and reports an error: makefile: 1141: install
- Zsh: command not found: pip3 & pip [How to Solve]