On Fri, Sep 14, 2018, at 4:26 PM, Paul Moore wrote: > I don't think it's "hard to predict". I *do* think it's badly documented/not > standardised. > ... > Better would be to have a supported library that exposes the logic pip > uses (or as I said above, the standard-defined logic) to determine > such paths. See https://github.com/pypa/pip/issues/5191
There is an official standard library API in the sysconfig module to find installation locations: https://docs.python.org/3/library/sysconfig.html#installation-paths Unfortunately, distutils has a copy of this logic rather than using the sysconfig module, from what I remember. Some Linux distros have patched distutils to put installed files in different locations, but have not necessarily patched sysconfig, presumably because they didn't think about it. Even if sysconfig were patched, distros may have a different location for files installed by the distro package manager and files installed by other means (Debian based distros use /usr and /usr/local for these). So there's no one data directory where you can find all files related to importable packages. (Of course, we advise against 'sudo pip install', but people still do it anyway). This may be somewhat outdated - it's been a while since I looked into this, but I don't think the relevant pieces are changing rapidly. My conclusion at the time was that the only reliable way to have data files findable at runtime was to put them inside the importable package. -- Distutils-SIG mailing list -- distutils-sig@python.org To unsubscribe send an email to distutils-sig-le...@python.org https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/ Message archived at https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/F6UIMBUEEBZON22X4XHKU65AFI6OLO2R/