Compiling bz2 support in python2

2019-08-02 18:07发布

问题:

I have

$ lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.6 (Final)
Release:    6.6
Codename:   Final

$ ls -l /lib64/libbz2.so.1
lrwxrwxrwx. 1 root root 15 May 25  2016 /lib64/libbz2.so.1 -> libbz2.so.1.0.4

I did:

Python-2.7.12 $ export LDFLAGS="-L/lib64";  ./configure --prefix=/some/dir

Python-2.7.12 $ make

And got:

Python build finished, but the necessary bits to build these modules were not found:
_sqlite3           _tkinter           bsddb185
bz2                dl                 imageop

How do I build support for bz2 module?

回答1:

wget http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz
tar -xvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
make -f Makefile-libbz2_so
make
make install PREFIX=/some/dir

cd Python-2.7.3
./configure --prefix=/some/dir
make install

This worked for me.

Copied the instructions from here: Compile Python with bz2 support