[Python-Dev] compile python 3.3 with bz2 support
o1dnik
bootblack00 at gmail.com
Tue Oct 22 17:08:34 CEST 2013
Oleg Broytman <phd <at> phdru.name> writes:
>
> Hello.
>
> We are sorry but we cannot help you. This mailing list is to work on
> developing Python (adding new features to Python itself and fixing bugs);
> if you're having problems learning, understanding or using Python, please
> find another forum. Probably python-list/comp.lang.python mailing
list/news
> group is the best place; there are Python developers who participate in
it;
> you may get a faster, and probably more complete, answer there. See
> http://www.python.org/community/ for other lists/news groups/fora. Thank
> you for understanding.
>
> On Fri, Dec 21, 2012 at 02:03:40PM +0800, 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'
>
> You have to install bz2 development files (headers and libraries)
> before recompiling python.
>
> > By the way, RedHat 5.5 has a built-in python 2.4.3. Would it be a
problem?
>
> Depends on what are you going to do.
>
> Oleg.
I've faced the same problem: while installing packages packed in .tar.bz2
using pip it failed with the same error on importing BZDecompress from _bz2
module (it could not find the `_bz` module).
So You can solve the problem by adding a prefix with direct location to your
compiled python3.3. <b>But first you need to add a custom path to libbz2 in
this line[1357] in setup.py<b>:
# Gustavo Niemeyer's bz2 module.
if (self.compiler.find_library_file('/lib/i386-linux-gnu/libbz2.so.1.0.4/',
'bz2')): # lib_dirs, 'bz2')):
then make && make -f Makefile-libbz2_so && make install
(and be careful passing correct --prefix to ./configure)
More information about the Python-Dev
mailing list