Where does Python look for libraries?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ACB

    #1

    Where does Python look for libraries?

    I have been trying to get the gdmodule installed and have run into an issue.
    When I import gd I get the following error.
    [color=blue][color=green][color=darkred]
    >>> import gd[/color][/color][/color]
    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "/usr/local/lib/python2.3/site-packages/gd.py", line 10, in ?
    import _gd
    ImportError: /usr/local/lib/libgd.so.2: Undefined symbol "libiconv_o pen"

    But, when I run
    nm libiconv.so
    in the directory with the iconv library I get an entry like this
    00011fe0 T libiconv_open

    so I know the functionality is there. So, my question. Does python have a
    way to add search directories for locating libraries?

    Thanks.


  • Jesus Rivero - (Neurogeek)

    #2
    Re: Where does Python look for libraries?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Python has sys.path
    If you want to add dirs into your PYTHONPATH add them to sys.path


    Jesus Rivero - (Neurogeek)

    ACB wrote:
    [color=blue]
    > I have been trying to get the gdmodule installed and have run into
    > an issue. When I import gd I get the following error.
    >[color=green][color=darkred]
    >>>> import gd[/color][/color]
    >
    > Traceback (most recent call last): File "<stdin>", line 1, in ?
    > File "/usr/local/lib/python2.3/site-packages/gd.py", line 10, in ?
    > import _gd ImportError: /usr/local/lib/libgd.so.2: Undefined symbol
    > "libiconv_o pen"
    >
    > But, when I run nm libiconv.so in the directory with the iconv
    > library I get an entry like this 00011fe0 T libiconv_open
    >
    > so I know the functionality is there. So, my question. Does
    > python have a way to add search directories for locating libraries?
    >
    >
    > Thanks.
    >
    >[/color]

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.1 (GNU/Linux)
    Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

    iD8DBQFEKFHNdIs sYB9vBoMRAli3AJ 9dFHXpXnrKCWiiS ZZhuedKvZnQXgCe LeQF
    QbRIUt2RC//D+RMrWFsg8lY=
    =S8Ke
    -----END PGP SIGNATURE-----

    Comment

    • Robert Kern

      #3
      Re: Where does Python look for libraries?

      Jesus Rivero - (Neurogeek) wrote:[color=blue]
      > Python has sys.path
      > If you want to add dirs into your PYTHONPATH add them to sys.path[/color]

      The OP seems to be asking about C libraries dynamically linked to extension
      modules, not Python libraries.
      [color=blue]
      > ACB wrote:[color=green][color=darkred]
      >>>I have been trying to get the gdmodule installed and have run into
      >>>an issue. When I import gd I get the following error.
      >>>
      >>>
      >>>>>>import gd
      >>>
      >>>Traceback (most recent call last): File "<stdin>", line 1, in ?
      >>>File "/usr/local/lib/python2.3/site-packages/gd.py", line 10, in ?
      >>>import _gd ImportError: /usr/local/lib/libgd.so.2: Undefined symbol
      >>>"libiconv_op en"
      >>>
      >>>But, when I run nm libiconv.so in the directory with the iconv
      >>>library I get an entry like this 00011fe0 T libiconv_open
      >>>
      >>>so I know the functionality is there. So, my question. Does
      >>>python have a way to add search directories for locating libraries?[/color][/color][/color]

      No. You will have to read your OS's documentation on how to make sure
      libiconv.so is in a location your dynamic linker will look for shared libraries.
      If you are on Linux, then probably

      $ man ld.so

      will tell you the appropriate information.

      --
      Robert Kern
      robert.kern@gma il.com

      "I have come to believe that the whole world is an enigma, a harmless enigma
      that is made terrible by our own mad attempt to interpret it as though it had
      an underlying truth."
      -- Umberto Eco

      Comment

      Working...