I\'m using redhat 5.8, which comes with python 2.4 installed automatically, but I\'m using a python package that requires python 2.6 or higher. SO, I installed python 2.7 a
Just did this yesterday on the same platform and got it working. Here's what I did:
Set CFLAGS="-I/path/to/bz2/include"
and LDFLAGS="-L/path/to/bz2/lib"
. Make sure the bz2 library path is set in your LD_LIBRARY_PATH
. You'll likely need to do a make distclean
and configure && make && make install
, though.
If that fails, directly edit the setup.py and make a replacement similar to the following:
# Gustavo Niemeyer's bz2 module.
if (self.compiler.find_library_file(['/home/someuser/packages/libbz2/lib'], 'bz2')): #lib_dirs, 'bz2')):
Note the commented out portion at the end of the second line is the original rest of the setup.py line.
Also, I found just downloading and building the latest version of bz2 and pointing all of the above to that easier than trying to get the system installed version to work.
Regardless, this definitely works. I did it yesterday :)
The other answers provided are useful and helpful, but this is how I got this to work.
The problem wasn't that Python wasn't finding the files (as I thought), it just couldn't use them properly. So, I vi'ed into the Makefile for bzip2, found the line that looked like this:
CFLAGS= -Wall -Winline -O2 -g $(BIGFILES)
and added -fPIC to the line like so:
CFLAGS=-fPIC -Wall -Winline -O2 -g $(BIGFILES)
and WHALA! It compiled just fine.
Any time you're working with a python other than the system-installed one, I strongly suggest using http://pypi.python.org/pypi/virtualenv. It sets up a "sandbox" for you with its own copy of python and redoes all the paths, etc. to point to the new copy. You can then use pip to install whatever packages you need.