no module named zlib
Sounds like you need to install the devel package for zlib, probably want to do something like
# ubuntu 12,14,16,18,20.04+
sudo apt-get install zlib1g-dev
Instead of using python-brew you might want to consider just compiling by hand, it's not very hard. Just download the source, and configure
, make
, make install
. You'll want to at least set --prefix
to somewhere, so it'll get installed where you want.
./configure --prefix=/opt/python2.7 + other options
make
make install
You can check what configuration options are available with ./configure --help
and see what your system python was compiled with by doing:
python -c "import sysconfig; print sysconfig.get_config_var('CONFIG_ARGS')"
The key is to make sure you have the development packages installed for your system, so that Python will be able to build the zlib
, sqlite3
, etc modules. The python docs cover the build process in more detail: http://docs.python.org/using/unix.html#building-python.
Python: No Module named Zlib, Mac OS X El Capitan 10.11.6
Installing the MacOS SDK Headers as suggested by this issue solves this problem fairly cleanly.
To do so, run the following (for MacOS 10.14):
xcode-select --install
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
and then brew install python
Related Topics
Naturally Sorting Pandas Dataframe
How to Create a "View" on a Python List
How to Set Class Attributes from Variable Arguments (Kwargs) in Python
How to Resolve Typeerror: Can Only Concatenate Str (Not "Int") to Str
Matplotlib Fill Between Multiple Lines
How to Check the Versions of Python Modules
When I Catch an Exception, How to Get the Type, File, and Line Number
Split a String with Unknown Number of Spaces as Separator in Python
"Pythonic" Method to Parse a String of Comma-Separated Integers into a List of Integers
Postponing Functions in Python
Spark Dataframe Distinguish Columns with Duplicated Name
Numpy Index Slice Without Losing Dimension Information
How to Create Animated Sprites Using Sprite Sheets in Pygame
Escape String Python for MySQL