Generally you will only find RPMs for the default Python version in the yum repository, however that shouldn't really be applicable here since zlib should be installed by default in your Python 2.7 installation.
Check sys.path using import sys; print sys.path and make sure that you have the lib directories for your Python 2.7 installation, it is possible that whatever you are doing in .bashrc is causing you to pick up the Python 2.4 environment.
Here is the location of my zlib module, which may be useful in trying to track down the location of yours so you can make sure it is on sys.path.
>>> import zlib
>>> zlib
<module 'zlib' from '/usr/local/lib/python2.7/lib-dynload/zlib.so'>
If you cannot find it then you should reinstall Python 2.7.
Answer from Andrew Clark on Stack OverflowGenerally you will only find RPMs for the default Python version in the yum repository, however that shouldn't really be applicable here since zlib should be installed by default in your Python 2.7 installation.
Check sys.path using import sys; print sys.path and make sure that you have the lib directories for your Python 2.7 installation, it is possible that whatever you are doing in .bashrc is causing you to pick up the Python 2.4 environment.
Here is the location of my zlib module, which may be useful in trying to track down the location of yours so you can make sure it is on sys.path.
>>> import zlib
>>> zlib
<module 'zlib' from '/usr/local/lib/python2.7/lib-dynload/zlib.so'>
If you cannot find it then you should reinstall Python 2.7.
The zlib and zlib-devel packages are the C shared and development libraries, respectively; the zlib you are importing in Python 2.4 is the one that shipped in the python-libs package:
$ rpm -qf /usr/lib64/python2.4/lib-dynload/zlibmodule.so
python-libs-2.4.3-46.el5
I don't know where you got your Python 2.7 from, but zlib is part of the standard library--it should have been built with Python. You will need to acquire a zlib module that was built against Python 2.7.
zlib1g is not a linux command/executable binary.
zlib1g is a library and zlib1g-dev are headers for c/c++. You need to add linker flag -lz when compiling so it will include zlib.
I have installed the zlib1g...
sudo apt install build-essential libpcre3 libpcre3-dev libssl-dev
- You didn't installed
zlib1g.zlib1gis calledzlib1gnotlibpcreorlibssl, installed withsudo apt install zlib1g, or withzlib1g-devif you want to develop something withzlib1g-dev. zlib1gis a library not an executable, which means it is used to put there, waiting for other executable or library to call it, not waiting for calling from a terminal command. You should detect an library by writing a program that#includes it or using a package manager command.