'How do I find where Python's libpython is located?
I'm using Conda on macOS, and I'm getting an error while building a Rust package that it can't find the libpython3.7m.dylib library. How can I find this?
After doing some research, on Linux you usually can install it from python-dev on Ubuntu, or by enabling --enabled-shared during Python compilation.
Solution 1:[1]
Python's build configuration can be found using distutils.sys_config.
from distutils.sysconfig import get_config_var
print(get_config_var("LIBDIR"))
# /Users/liamz/anaconda3/lib
print(get_config_var("LDLIBRARY"))
# libpython3.7m.dylib
Or as a one-liner:
python3 -c 'from distutils.sysconfig import get_config_var; print(get_config_var("LIBDIR"))'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | liamzebedee |
