Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine the path & name of the Python shared library?

Tags:

python

Given a Python compiled as a shared library, how do I determine the name and path of this library?

The output I'm looking for is like "/usr/local/lib/libpython2.7.so" or "/System/Library/Frameworks/Python.framework/Versions/2.6/Python" (for a framework build on OS X).

like image 845
Adam Vandenberg Avatar asked Oct 16 '10 16:10

Adam Vandenberg


1 Answers

I'm not sure how or if it can be done within Python itself, but you can use standard tools for finding shared library dependencies for the python executable.

Linux: ldd <path>/python or ldd $(which python)
Mac: otool -L <path>/python
Windows: run dependencywalker on python.exe

like image 67
snapshoe Avatar answered Oct 08 '22 18:10

snapshoe