【发布时间】:2016-09-15 22:01:51
【问题描述】:
如何将 Python 模块与预编译的 .so 库打包在一起?具体来说,我该如何写setup.py,这样当我在Python中这样做时
>>> import top_secret_wrapper
不用设置LD_LIBRARY_PATH也能轻松找到top_secret.so?
在我的模块开发环境中,我的文件结构如下:
.
├── top_secret_wrapper
│ ├── top_secret.so
│ └── __init__.py
└── setup.py
在__init__.py 里面,我有类似的东西:
import top_secret
这是我的setup.py
from setuptools import setup, Extension
setup(
name = 'top_secret_wrapper',
version = '0.1',
description = 'A Python wrapper for a top secret algorithm',
url = None,
author = 'James Bond',
author_email = 'James.Bond.007@mi6.org',
license = 'Spy Game License',
zip_safe = True,
)
我确定我的setup.py 缺少指定top_secret.so 位置的设置,但我不知道该怎么做。
【问题讨论】:
标签: python package setuptools distutils