I am using redhat 5.8, which comes with python 2.4 installed automatically, but I am using a python package that requires python 2.6 or higher. SO, I installed python 2.7 next to 2.4 so as not to step on the version of the system.
Now I am trying to install the package via pip and get the following error:
CompressionError: bz2 module is not available
However, I have a module on my machine, as evidenced when I do this, the server version gives:
[~]$ python -c "import bz2; print bz2.__doc__" The python bz2 module provides a comprehensive interface for the bz2 compression library. It implements a complete file interface, one shot (de)compression functions, and types for sequential (de)compression.
and 2.7 set the errors this way:
[~]$ python2.7 -c "import bz2; print bz2.__doc__" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named bz2
So, I read the following questions: Already installed and this one is very good , but none of them seems to be quite suitable. In the first case, we advise you to install the missing part, and the second question is to remove (or terminate the link) an additional python installation.
What I want to do is put in a symbolic link or some of them, so installing python 2.7 knows where bz2 is, so I can use pip to install the python package.
Thank you in
EDIT: additional information
So, after much research, it turned out that the way the variable paths are set has changed a lot in python 2.5 (maybe why the red hat hasn't been updated).
So, in python 2.7 you can add PYTHONPATH to the variable by adding a file with the extension .pth in this folder:
/usr/local/lib/python2.7/site-packages/
I tried 2 ways to make this work correctly.
At first, I just uploaded a few python 2.4 path files to 2.7. This caused a different type of error:
[~]$ python2.7 -c "import bz2; print bz2.__doc__" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: /usr/lib64/python2.4/lib-dynload/bz2.so: undefined symbol: Py_InitModule4
So this is something.
I also tried to specify the path to the libbz2.so file in / usr / lib /, which led to a known error:
[~]$ python2.7 -c "import bz2; print bz2.__doc__" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named bz2
I'm still at a dead end, but I feel like I'm closing.
I really could use some data from someone who has more experience setting up a programming environment. I am much more comfortable writing code :)