2

I started with web development in python(ver:3.5.3) with flask. But when I tried importing zlib getting import error

Python 3.5.3 (default, Mar 20 2017, 16:01:17) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zlib 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'zlib

Tried several approaches found in stack overflow from this post as,

sudo apt-get install zlib1g-dev

but this will install in my default python version i.e. 2.7.12. And in that zlib import works without any error.

I also tried below command, which should build the dependencies

sudo apt-get build-dep python3.5.3

but getting below error

Reading package lists... Done
E: You must put some 'source' URIs in your sources.list

Any other approach that I will go with ?

napster
  • 121

1 Answers1

1

Try to install the python in such a way. It includes zlib support

./configure --with-zlib
make
sudo make altinstall