Skip to content
Advertisement

Altinstall of Python 2.7.13 on RHEL7 just launches system version

I’m doing an altinstall of Python 2.7.13 on RHEL7 which has 2.7.5 installed. Here’s how I’m building from source:

$ ./configure --prefix=/usr/local --enable-shared
$ make && sudo make altinstall

However, even when I tried to access this altinstall directly, I’m getting the system Python, rather than the altinstall. I’ve put SELinux into permissive mode and get the same result.

$ /usr/local/bin/python2.7 -V
Python 2.7.5
$ getenforce
Permissive

and when I enter the interpreter

$ /usr/local/bin/python2.7
Python 2.7.5 (default, Aug  2 2016, 04:20:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

I’m at a loss here. From everything I’ve been reading this should work. The only thing I can think of is that since they’re both 2.7.X there’s some sort of conflict, but I thought that was the reason for altinstalls in the first place.

Advertisement

Answer

I believe you’re running into the same problem as in this thread: Strange Python compilation results with “–enable-shared” flag.

To fix it, you need to use:

LD_RUN_PATH=/usr/local/lib make && sudo make altinstall

(So that the generated binary looks for the correct shared Python library.)


As a sidenote, I think you’d be much better served by Red Hat Software Collections when you need to have different Python versions on one system. Check out About RHSCL.

Advertisement