skillfed

find-libpython

Finds the libpython associated with your environment, wherever it may be hiding

find-libpython v0.5.1 986.9K downloads/30d#4,572 on PyPI22
Permissive license MIT Active released

What it is and what it does

find_libpython is a utility that discovers the path to the libpython shared library for your current Python environment. It handles the complexity of locating libpython across different installation methods—conda, system package managers, custom builds—and different operating systems. The package works both as a command-line tool (useful in makefiles and build scripts) and as a Python library (useful in distutils-based build systems or Python code that embeds a Python interpreter).

The main use case is enabling other projects to link against or embed Python without hardcoding library paths. It abstracts away platform-specific search logic and installation variations, returning either the path as a string or None if the library cannot be found. No external dependencies are required, making it lightweight to integrate into build toolchains.

Use it for:

  • Embed a Python interpreter in a C/C++ application by discovering the correct libpython to link against.
  • Build Python extension modules in makefile-based systems by querying the script for the libpython path.
  • Automate library path resolution in distutils or setuptools-based build systems across multiple platforms.
  • Locate libpython in conda environments or custom Python installations for FFI bindings.
  • Debug Python installation issues by inspecting candidate library names and paths via CLI flags.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Locates the libpython dynamic library path for the current Python environment, working across conda, system, and custom installations on Windows, macOS, and Linux.

Yes. The package solves a genuine cross-platform problem with no dependencies, active maintenance, and a permissive license. Install it if you need to locate libpython for embedding, linking, or build automation. The low friction and clear scope make it a safe addition to build toolchains.

Install

find-libpython on PyPI

pip

pip install find-libpython

uv

uv add find-libpython

poetry

poetry add find-libpython

Installing find-libpython

Before you install

Low install friction with no runtime dependencies. Actively maintained with a recent release and steady repository activity.

License in practice

MIT license permits commercial and private use with minimal restrictions; attribution required.

Quickstart

pip install find-libpython

from find_libpython import find_libpython
path = find_libpython()
print(path)  # e.g., /home/user/miniconda3/envs/test/lib/libpython3.8.so.1.0

Requires Python 3.9 or later.

Verify before relying

  • Whether the package successfully locates libpython in all edge-case installations (e.g., static builds, non-standard layouts).
  • Performance characteristics when called repeatedly or on systems with many candidate paths.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 184 days since the last release
Last repo commit
First released
Downloads 986,854/month — #4,572 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: find_libpython-0.5.1-py3-none-any.whl

Programming Language :: Python :: 3Topic :: Software Development :: Libraries

Tags

find libpython pathlibpython locationpython library linkingembed python interpreterlibpython dynamic librarypython c api linkingfind python library
build-systemc-interopcross-platform

More Libraries packages