Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

compile python 3.3 with bz2 support

1,571 views
Skip to first unread message

Isml

unread,
Dec 21, 2012, 1:27:54 AM12/21/12
to python-list
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@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?
 

Miki Tebeka

unread,
Dec 22, 2012, 10:28:23 AM12/22/12
to python-list
On Thursday, December 20, 2012 10:27:54 PM UTC-8, Isml wrote:
>     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)
Why can't you use yum? (yum install libbz2-dev)

>     [root@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'
IMO it's a linker problem. If libbz2.zo is in /usr/local/lib then try
LB_LIBRARY_PATH=/usr/local/lib python3 -c 'import bz2'

If this work, you can add /usr/local/lib to the linker by doing:
echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf
ldconfig

Having said that, if the yum way work - do it.


> By the way, RedHat 5.5 has a built-in python 2.4.3. Would it be a problem?
I don't think so. I have multiple version of Python on RedHat systems.

Miki Tebeka

unread,
Dec 22, 2012, 10:28:23 AM12/22/12
to comp.lan...@googlegroups.com, python-list
On Thursday, December 20, 2012 10:27:54 PM UTC-8, Isml wrote:
>     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)
Why can't you use yum? (yum install libbz2-dev)

>     [root@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'
IMO it's a linker problem. If libbz2.zo is in /usr/local/lib then try
LB_LIBRARY_PATH=/usr/local/lib python3 -c 'import bz2'

If this work, you can add /usr/local/lib to the linker by doing:
echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf
ldconfig

Having said that, if the yum way work - do it.


> By the way, RedHat 5.5 has a built-in python 2.4.3. Would it be a problem?

Benjamin Kaplan

unread,
Dec 22, 2012, 11:06:51 AM12/22/12
to Python List


On Dec 21, 2012 1:31 AM, "Isml" <7606...@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@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?

ign...@gmail.com

unread,
Oct 5, 2014, 11:08:19 PM10/5/14
to
sudo apt-get install libbz2-dev

Python-3.4.1$ ./configure --with-pydebug --with-bz2 --prefix=/usr && make -j2
0 new messages