回复: compile python 3.3 with bz2 support

Isml 76069016 at qq.com
Mon Dec 24 07:23:36 CET 2012


Finally I worked it out. I write it down Here to people who meet the same problem like me.
 1. Install bzip2 from source is OK
 2. There is no need to add "--with-bz2" to "./configure", because it is not a valid param. python makefile will search the bz2 itself, if it find the bz2 lib, it will automatically compile this module. see setup.py line 1373. So the "./configure" outputs the warning : "configure: WARNING: unrecognized options: --with-bz2"
 3. The reason why I failed before is that I did not correctly compile the bz2.so, the filename "_bz2.cpython-33m_failed.so" has indicated that fact. And the reason why I faild to compile bz2.so is strangely the RedHat "SELinux". So the only thing I then do is disable it (setenforce 0), after that, everything is OK.
  
 Thanks for everyone.
  

 

 ------------------ 原始邮件 ------------------
  发件人: "Isml"<76069016 at qq.com>;
 发送时间: 2012年12月24日(星期一) 中午11:21
 收件人: "Benjamin Kaplan"<benjamin.kaplan at case.edu>; "Python List"<python-list at python.org>; 
 
 主题: 回复: compile python 3.3 with bz2 support

 

 Thanks for your reply.According to your advice, I tried again, but still failed. Here is how I do this time:
1. I did not find package "libbz2-dev" in my source, so I still install it from source
2. I carefully checked the output of "./confiruge" this time and find a warning : "configure: WARNING: unrecognized options: --with-bz2", so I used a wrong param?
3. I checked the build-in Python 2.4.3 which can successfully "import bz2",and find a "bz2.so" in it's lib dir(/usr/lib/python2.4/lib-dynload/bz2.so),I check the dependency of this file
[root at localhost lib-dynload]# ldd /usr/lib/python2.4/lib-dynload/bz2.so 
        linux-gate.so.1 =>  (0x002a0000)
        libbz2.so.1 => /usr/lib/libbz2.so.1 (0x00336000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00fa5000)
        libc.so.6 => /lib/libc.so.6 (0x00128000)
        /lib/ld-linux.so.2 (0x003e5000)
 
it seems that the redhat has already installed the libbz2.so. But I failed to find such a file
in my own compiled python 3.3 lib dir(/usr/local/lib/python3.3/lib-dynload/), strangely I see a file named "_bz2.cpython-33m_failed.so", the name indicated that it is not a right file. I renamed it to bz2.so and tried again, finally get a
error:
>>> import bz2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (PyInit_bz2)

  

 

 ------------------ 原始邮件 ------------------
  发件人: "Benjamin Kaplan"<benjamin.kaplan at case.edu>;
 发送时间: 2012年12月23日(星期天) 凌晨0:06
 收件人: "Python List"<python-list at python.org>; 
 
 主题: Re: compile python 3.3 with bz2 support

 

 

On Dec 21, 2012 1:31 AM, "Isml" <76069016 at qq.com> wrote:
>
> hi, everyone:
>     I want to compile python 3.3 with bz2 support on RedHat 5.5 but fail to do that. Here is how I do it:
>     1. download bzip2 and compile it(make、make -f Makefile_libbz2_so、make install)
>     2.chang to python 3.3 source directory : ./configure --with-bz2=/usr/local/include
>     3. make
>     4. make install
>  
>     after installation complete, I test it:
>     [root at localhost Python-3.3.0]# python3 -c "import bz2"
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "/usr/local/lib/python3.3/bz2.py", line 21, in <module>
>     from _bz2 import BZ2Compressor, BZ2Decompressor
> ImportError: No module named '_bz2'
> By the way, RedHat 5.5 has a built-in python 2.4.3. Would it be a problem?
>  
>
> --
 
What is the output of configure? The last thing it does is list which modules are not going to be built. Is bz2 on the list? What does configure say when it's looking for bz2?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121224/fbd54ce5/attachment.html>


More information about the Python-list mailing list