Python Error No Module Named Zlib
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business python zlib module install Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs
No Module Named Zlib Virtualenv
Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just importerror no module named zlib centos like you, helping each other. Join them; it only takes a minute: Sign up Virtualenv no module named zlib up vote 7 down vote favorite 5 I'm trying to create Python 2.7 virtual env under Python2.6, I'm no module named zlib mac simply running: virtualenv --python=python27 #python27 correctly leads to my python installation in /opt/python2.7/bin/python Virtualenv fails with following error Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/virtualenv.py", line 17, in
Python Install Zlib Windows
rpm -qa | grep zlib zlib-1.2.3-29.el6.x86_64 zlib-1.2.3-29.el6.i686 zlib-devel-1.2.3-29.el6.x86_64 There are two other questions concerning this issue, here and here, in both cases people simply don't have zlib installed which is not my case (I have it in python 2.6, which should be ok right?), they are also using pythonbrew which is apparently no longer under active development. Why virtualenv can't find zlib? How virtualenv looks up its modules? Do I need to install zlib in my Python2.7? Or reinstall Python2.7 so that zlib is suppported? Sidenote:please don't ask why I'm using old versions, it's not my choice. python virtualenv zlib share|improve this question edited Dec 29 '13 at 20:25 asked Dec 29 '13 at 20:02 Pawel Miech 4,16211429 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted zlib is a Python module that interfaces with the zlib library on your computer. It is part of the standard library, so it should be on all Python 2.7 installs. If it's not, in your case, then that likely means that your version of Python was compiled without zlib support for some reason. I can't imagine why, unless it's related to something you did to enable the use of older versions of zlib. I think you will need to find another Python package, or compile Python yourself. share|improve
not include zlib as part of the standard library without some extra work. If you're on a relatively new Ubuntu version but still need to python zlib not available maintain backwards compatability with a Python2.6 program, shared library directory python import zlib not found changes in Ubuntu can lead to conflicts. Prerequisites Ensure the following packages are installed $ sudo apt-get
Python Zlib Windows
install zlib1g zlib1g-dev Download the latest source of Python2.6 (which is Python 2.6.9 at the time of this article) ~$ cd /tmp /tmp$ wget "https://www.python.org/ftp/python/2.6.9/Python-2.6.9.tgz" /tmp$ tar http://stackoverflow.com/questions/20829507/virtualenv-no-module-named-zlib -xf Python-2.6.9.tgz Solution This post on UbuntuForums outlines the issues with Python2.6 compatibility with newer Ubuntu versions. It is Ubuntu's "fault". They changed where shared libraries are placed in order to support multiple architectures better (eg both x86 and x86_amd64 on the same machine) in a way that diverges from how it has always been http://joequery.me/guides/python26-no-module-zlib/ done in the past. ... ... Upstream Python is being patched, but that doesn't really help as they are only doing it with current versions of Python So we need to locate the libz shared library file and move it to a place where Python can locate it. Locating the libz file First, cd to the /lib directory $ cd /lib Now we will find the exact libz shared library file via the find command /lib$ find . -name "libz.so.1" ./i386-linux-gnu/libz.so.1 My libz.so.1 file was located at ./i386-linux-gnu/libz.so.1. Your libz file may be in a different directory. We will now create a symlink to libz.so.1 file that was returned by the find command above. /lib$ sudo ln -s i386-linux/gnu/libz.so.1 libz.so Recompile Now head back over to the Python-2.6.9 directory we untarred earlier. /lib$ cd /tmp/Python-2.6.9 Now we compile from source /tmp/Python-2.6.9$ ./configure /tmp/Python-2.6.9$ make && sudo make altinstall Verification /tmp/Python-2.6.9$ python2.6 Python 2.6.9 (unknown, Sep 6 2015, 20:22:36) [GCC 4.8.2] on li
bunch of Python related errors like: https://www.reddit.com/r/learnpython/comments/3v020c/centos_dont_have_zlib_module_cant_create/ ImportError: No module named zlib zlib was installed via Xcode, but not in /usr/include. The problem that causes this error above is simply that Python wasn’t installed with zlib support when built by no module Homebrew. When you look into the brew formula for Python, you’ll notice the following line: brew cat python | grep zlib args << "CPPFLAGS=-I#{MacOS.sdk_path}/usr/include" # find zlib Brew seemed to be unable to locate the zlib header to compile against. no module named Actually ls /usr/include/zlib.h validates this. There are a lot of problems relating to Xcode and it’s behaviour on recent OS X versions, causing this very type of problems. (Actually MacOS.sdk_path is empty, as well as /usr/include.) Well, although I thought I had have the Xcode CLI related things installed, it seemed I had not. The following line fixes this: xcode-select --install Before reinstalling Python I checked if the zlib header is where brew is looking for it: ls /usr/include/zlib.h Yes it is! Awesome. So let’s reinstall Python: brew reinstall python This should result in a working Python distribution on your Mac with zlib support. Now go ahead and hack some Python! Site proudly generated by Hakyll © 2013—2016 Christian Schulze
»learnpythoncommentsWant to join? Log in or sign up in seconds.|Englishlimit my search to /r/learnpythonuse the following search parameters to narrow your results:subreddit:subredditfind submissions in "subreddit"author:usernamefind submissions by "username"site:example.comfind submissions from "example.com"url:textsearch for "text" in urlselftext:textsearch for "text" in self post contentsself:yes (or self:no)include (or exclude) self postsnsfw:yes (or nsfw:no)include (or exclude) results marked as NSFWe.g. subreddit:aww site:imgur.com dogsee the search faq for details.advanced search: by author, subreddit...this post was submitted on 01 Dec 20151 point (100% upvoted)shortlink: remember mereset passwordloginSubmit a new text postlearnpythonsubscribeunsubscribe67,004 readers100 users here now Welcome to /r/LearnPython! Please read the rules and guidelines below and search before posting. Learning resources All learning resources are in the wiki: /r/learnpython/w/index Frequently Asked Questions: /r/learnpython/w/FAQ IRC Chat Join us in the IRC channel: ##learnpython on irc.freenode.net Webchat link: webchat.freenode.net Guide on how to join and different IRC clients: /wiki/IRC Rules General Rules Posting only assignment/project goal is not allowed. Read posting guidelines. Easily googleable questions are not allowed. Posting screenshot of the code is (generally) not allowed. Read posting guidelines. Insulting will not be tolerated. Reddit rules These