Python 2.2.1, Solaris 8, gcc compile question

John Hunter jdhunter at
Tue Oct 22 16:19:18 CEST 2002

>>>>> "Hennie" == Hennie Rautenbach <hennie at> writes:

    Hennie> $ /usr/local/bin/python Python 2.2.1 (#1, Oct 22 2002,
    Hennie> 14:27:46) [GCC 3.0.3] on sunos5 Type "help", "copyright",
    Hennie> "credits" or "license" for more information.
    >>>> import time
    Hennie> Traceback (most recent call last): File "<stdin>", line 1,
    Hennie> in ?  ImportError: /usr/local/bin/python: fatal:
    Hennie> open failed: No such file or directory

This problem typically arises when the program was compiled and
installed in one environment and executed in another.  When it was
compiled, the compiler could find, but when it is executed,
the shared library is not in your LD_LIBRARY_PATH.

You probably do not need to recompile python (unless it was compiled
on another system or with a cross compiler).  First try and find the
dir on your system in which resides.  Three suggestions:

If you have gnu findutils, just do 'locate'.  Otherwise,

  # ldd /usr/local/bin/python

This will list the shared libraries that python needs and where they
are.  If you can't find it that way, try:

  # find /usr -name
  # find /opt -name

Now if you still can't find it, I'll guess that it's not on your
system and python was compiled on another machine.  If you do find it
here's how to modify LD_LIBRARY_PATH so you can see it when you
execute python.  Suppose you found it in /some/dir/lib

If you are a csh/tcsh user

  # setenv LD_LIBRARY_PATH /some/dir/lib:/usr/local/lib:/usr/lib:/lib:/other/dir:/lib

If you are a bash user

  # export LD_LIBRARY_PATH=/some/dir/lib:/usr/local/lib:/usr/lib:/lib:/other/dir:/lib

This command should go in your rc file, eg, ~/.tcshrc, ~/.cshrc, or
~/.bashrc.  Now open up a new shell/xterm, and try typing python

If you are still having trouble, make sure that your environment
variable was set correctly with:

csh/tcsh:  # setenv | grep LD 
bash:      # set | grep LD

You should see the dirs you entered in for LD_LIBRARY_PATH.

Good luck,
John Hunter

More information about the Python-list mailing list