Issues installing Python 2.7

Michael Torrie torriem at gmail.com
Thu Nov 27 05:04:20 CET 2014


To further explain my terse post from before (from my phone), see below.

On 11/26/2014 10:09 AM, billyfurlong at gmail.com wrote:
> Now the installation worked fine but shouldn't I see that it's using the correct version???
> 
> I also did try to run /opt/python2.7/bin/python2.7 and it give me this.
> 
> [root at wmy machine bin]# python2.7
> python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
> 
> Please help the newb.  He's frustrated.

So the longer answer is that only certain directories are searched by
Linux for shared libraries. Python happens to provide a shared library,
which it depends on, which is installed by the source tarball in /opt
along with the binaries.  There are a number of ways you can solve this:

- Create a file in /etc/ld.so.conf.d/python2.7.conf and place in it the
following path:
/opt/python2.7/lib

- before running /opt/python2.7/bin/python2.7, set the LD_LIBRARY_PATH
environment variable (example in bash):
$ LD_LIBRARY_PATH=/opt/python2.7/lib /opt/python2.7/bin/python2.7

- create a wrapper script in /usr/bin that sets LD_LIBRARY_PATH and
execs python2.7

I recommend the first as a permanent solution.






More information about the Python-list mailing list