未找到名为 zlib 的模块 [英] No module named zlib found

查看:54
本文介绍了未找到名为 zlib 的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了python2.6.6源表http://www.python.org/getit/releases/2.6.6/之后我运行这些命令./配置制作

I download python2.6.6 source form http://www.python.org/getit/releases/2.6.6/ After that I run these commands ./configure make

我尝试导入 zlib,但它说没有名为 zlib 的模块.如何为其安装 zlib 模块

I tried to import zlib but it says no module named zlib. How can install zlib module for it

在我尝试安装 python2.6.8 后,我遇到了同样的错误,没有 zlib.安装时出现以下错误

After I tried installing python2.6.8 I got same error no zlib. While installing it I got below error

未能找到构建这些模块所需的部分:

Failed to find the necessary bits to build these modules:

_bsddb             _curses            _curses_panel   
_hashlib           _sqlite3           _ssl            
_tkinter           bsddb185           bz2             
dbm                dl                 gdbm            
imageop            linuxaudiodev      ossaudiodev     
readline           sunaudiodev        zlib            

要找到必要的位,请在 setup.py 中的 detect_modules() 中查找模块名称.

To find the necessary bits, look in setup.py in detect_modules() for the module's name.

未能构建这些模块:

crypt              nis   

推荐答案

我尝试了以下这些模块,这对我有帮助.
您必须编辑 setup.py.
在 setup.py 中找到以下几行:

I tried following which helped me with some of these modules.
You have to edit setup.py.
Find the following lines in setup.py:

lib_dirs = self.compiler.library_dirs + [
   '/lib64', '/usr/lib64',
   '/lib', '/usr/lib',
   ]

对于 64 位
添加/usr/lib/x86_64-linux-gnu:

lib_dirs = self.compiler.library_dirs + [
   '/lib64', '/usr/lib64',
   '/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu',
   ]

对于 32 位
添加/usr/lib/i386-linux-gnu:

lib_dirs = self.compiler.library_dirs + [
   '/lib64', '/usr/lib64',
   '/lib', '/usr/lib', '/usr/lib/i386-linux-gnu',
   ]

注意 x86_64-linux-gnu &i386-linux-gnu 可能位于其他地方在您的系统中进行相应的路径.

Note x86_64-linux-gnu & i386-linux-gnu might be located somewhere else in your system so path accordingly.

在此之后,您将只剩下以下模块:

Ater this you will be left with only following modules:

_bsddb             bsddb185           dbm             
gdbm               sunaudiodev  

这篇关于未找到名为 zlib 的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆