There is no 'zlib' module for Python 2.6

When I run Python 2.7, I can import zlibno problem. Unfortunately, I need Python 2.6 for a specific project.

I tried to install it using this script. I wrote:

apt-get install zlib1g-dev
mkdir /tmp/shell_scripts
cd /tmp/shell_scripts
wget http://www.python.org/ftp/python/2.6.9/Python-2.6.9.tgz
tar -xvzf Python-2.6.9.tgz
rm Python-2.6.9.tgz
cd Python-2.6.9
./configure --with-zlib
make
make install
./python setup.py install
cd /tmp
rm -r shell_scripts

When I type import zlib, I get an import error. I need to zlibinstall easy_install. Do you have an idea what might be wrong?

+4
source share
1 answer

I found a solution on the blog: I had to create a symbolic link and set the environment variable. This is my working code:

apt-get install zlib1g-dev
cd /lib
sudo ln -s i386-linux-gnu/libz.so.1 libz.so

mkdir /tmp/shell_scripts
cd /tmp/shell_scripts
wget http://www.python.org/ftp/python/2.6.9/Python-2.6.9.tgz
tar -xvzf Python-2.6.9.tgz
rm Python-2.6.9.tgz
cd Python-2.6.9
make distclean
export LDFLAGS="-L/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
./configure
make
make install
./python setup.py install
unset LDFLAGS
cd /tmp
rm -r shell_scripts

Now import zlibno longer throws an error.

+4
source

Source: https://habr.com/ru/post/1529486/


All Articles