当前位置: 首页 > python > 正文

compile pyhton2.7 with zlib

ensure you have installed zlib on your OS.
[2hei.net]# rpm -qa|grep zlib
zlib-1.2.3-3
zlib-devel-1.2.3-3
use source code to compile python2.7:
./configure –enable-shared && make && make install
If you still have this issue:
python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file
solved:
vim /etc/ld.so.conf.d/python2.7.conf
/usr/local/lib
ldconfig
test:
[2hei.net]# python
Python 2.7.1 (r271:86832, Jan 14 2011, 01:34:20) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> imort
KeyboardInterrupt
>>> import sys
>>> sys.modules
{‘copy_reg’: <module ‘copy_reg’ from ‘/usr/local/lib/python2.7/copy_reg.pyc’>, ‘sre_compile’: <module ‘sre_compile’ from ‘/usr/local/lib/python2.7/sre_compile.pyc’>, ‘_sre’: <module ‘_sre’ (built-in)>, ‘encodings’: <module ‘encodings’ from ‘/usr/local/lib/python2.7/encodings/__init__.pyc’>, ‘site’: <module ‘site’ from ‘/usr/local/lib/python2.7/site.pyc’>, ‘__builtin__’: <module ‘__builtin__’ (built-in)>, ‘sysconfig’: <module ‘sysconfig’ from ‘/usr/local/lib/python2.7/sysconfig.pyc’>, ‘__main__’: <module ‘__main__’ (built-in)>, ‘encodings.encodings’: None, ‘abc’: <module ‘abc’ from ‘/usr/local/lib/python2.7/abc.pyc’>, ‘posixpath’: <module ‘posixpath’ from ‘/usr/local/lib/python2.7/posixpath.pyc’>, ‘_weakrefset’: <module ‘_weakrefset’ from ‘/usr/local/lib/python2.7/_weakrefset.pyc’>, ‘errno’: <module ‘errno’ (built-in)>, ‘encodings.codecs’: None, ‘sre_constants’: <module ‘sre_constants’ from ‘/usr/local/lib/python2.7/sre_constants.pyc’>, ‘re’: <module ‘re’ from ‘/usr/local/lib/python2.7/re.pyc’>, ‘_abcoll’: <module ‘_abcoll’ from ‘/usr/local/lib/python2.7/_abcoll.pyc’>, ‘types’: <module ‘types’ from ‘/usr/local/lib/python2.7/types.pyc’>, ‘_codecs’: <module ‘_codecs’ (built-in)>, ‘_warnings’: <module ‘_warnings’ (built-in)>, ‘genericpath’: <module ‘genericpath’ from ‘/usr/local/lib/python2.7/genericpath.pyc’>, ‘stat’: <module ‘stat’ from ‘/usr/local/lib/python2.7/stat.pyc’>, ‘zipimport’: <module ‘zipimport’ (built-in)>, ‘encodings.__builtin__’: None, ‘warnings’: <module ‘warnings’ from ‘/usr/local/lib/python2.7/warnings.pyc’>, ‘UserDict’: <module ‘UserDict’ from ‘/usr/local/lib/python2.7/UserDict.pyc’>, ‘encodings.utf_8’: <module ‘encodings.utf_8’ from ‘/usr/local/lib/python2.7/encodings/utf_8.pyc’>, ‘sys’: <module ‘sys’ (built-in)>, ‘codecs’: <module ‘codecs’ from ‘/usr/local/lib/python2.7/codecs.pyc’>, ‘os.path’: <module ‘posixpath’ from ‘/usr/local/lib/python2.7/posixpath.pyc’>, ‘signal’: <module ‘signal’ (built-in)>, ‘linecache’: <module ‘linecache’ from ‘/usr/local/lib/python2.7/linecache.pyc’>, ‘posix’: <module ‘posix’ (built-in)>, ‘encodings.aliases’: <module ‘encodings.aliases’ from ‘/usr/local/lib/python2.7/encodings/aliases.pyc’>, ‘exceptions’: <module ‘exceptions’ (built-in)>, ‘sre_parse’: <module ‘sre_parse’ from ‘/usr/local/lib/python2.7/sre_parse.pyc’>, ‘os’: <module ‘os’ from ‘/usr/local/lib/python2.7/os.pyc’>, ‘_weakref’: <module ‘_weakref’ (built-in)>}
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit

本文固定链接: http://2hei.net/compile_pyhton27_with_zlib.html | 2hei's site

该日志由 2hei 于2011年01月14日发表在 python 分类下,
原创文章转载请注明: compile pyhton2.7 with zlib | 2hei's site
关键字: ,

报歉!评论已关闭.