回复： compile python 3.3 with bz2 support
76069016 at qq.com
Mon Dec 24 04:21:54 CET 2012
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)
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
>>> 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...
More information about the Python-list