Discussion:
回复: compile python 3.3 with bz2 support
Isml
2012-12-24 03:21:54 UTC
Permalink
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
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
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"
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/98d90253/attachment.html>
Isml
2012-12-24 06:23:36 UTC
Permalink
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
Post by Isml
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
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"
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>
Continue reading on narkive:
Search results for '回复: compile python 3.3 with bz2 support' (Questions and Answers)
18
replies
what is the best comedy movie? for 13 & up (no R rated please)?
started 2007-06-30 13:56:45 UTC
movies
Loading...