Results 1 to 2 of 2

Thread: Python site-packages directory

  1. #1

    Default Python site-packages directory

    I'm writing a python package that uses a compiled library. Because the lib needs to be compiled for the different py versions, I want to put it in the site-packages subfolder that the rest of the package will reside in. But a python script needs to know the full path of the lib in order to access it.

    The problem is that the default install directory for opensuse is:

    /usr/local/lib/pythonV.v/site-packages/mypackage

    But I don't know a way to programmatically get this path either during packaging (to make sure the lib goes there) or at runtime (to access the lib correctly). distutils.sysconfig.get_python_lib() returns:

    /usr/lib/pythonV.v/site-packages

    So I have been hard coding the install path. But I'm hoping there is a better way. Any suggestions?

  2. #2
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    963

    Default Re: Python site-packages directory

    If I understand correctly, you want just to check some directory like /usr/local/lib/pythonV.v/site-packages/mypackage and be sure about library (is there or not), right?
    ...or you have to find the path for this library?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •