By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,908 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,908 IT Pros & Developers. It's quick & easy.

Auto locate Python's .so on Linux (for cx_Freeze's --shared-lib-name)

P: n/a
In a makefile I want to locate the .so for a dynamically linked
Python on Linux. (for cx_Freeze's --shared-lib-name)
e.g. by running a small script with that Python. How to?

Robert
Nov 17 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
robert wrote:
In a makefile I want to locate the .so for a dynamically linked
Python on Linux. (for cx_Freeze's --shared-lib-name)
e.g. by running a small script with that Python. How to?

Robert
How about run python -v yourscript and filter the output?

Nov 18 '07 #2

P: n/a
James Stroud wrote:
robert wrote:
>In a makefile I want to locate the .so for a dynamically linked Python
on Linux. (for cx_Freeze's --shared-lib-name)
e.g. by running a small script with that Python. How to?

Robert

def findaso(aso):
import os
for apath in os.sys.path:
if not apath.startswith(os.path.sep):
apath = os.path.join(os.path.curdir, apath)
try:
files = os.listdir(apath)
except OSError:
pass
if aso in files:
return apath
pydef findaso(aso):
... import os
... for apath in os.sys.path:
... if not apath.startswith(os.path.sep):
... apath = os.path.join(os.path.curdir, apath)
... try:
... files = os.listdir(apath)
... except OSError:
... pass
... if aso in files:
... return apath
...
pyfindaso('_tkinter.so')
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload'
James

I'd need to know already the name and oon this installation it is
for example /usr/lib/libpython2.4.so.1.0

/usr/lib is not in sys.path
Robert
Nov 18 '07 #3

P: n/a
Neal Becker wrote:
robert wrote:
>In a makefile I want to locate the .so for a dynamically linked
Python on Linux. (for cx_Freeze's --shared-lib-name)
e.g. by running a small script with that Python. How to?

Robert

How about run python -v yourscript and filter the output?
for examples here python -v delivers many other python module
paths, but not Python's .so. For example

/usr/lib/libpython2.4.so.1.0

Robert
Nov 18 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.