Python 使用setuptools作为源分发扩展模块
我正在测试将一个Python扩展模块作为使用setuptools创建的鸡蛋分发。 以下是我的setup.py脚本:Python 使用setuptools作为源分发扩展模块,python,setuptools,Python,Setuptools,我正在测试将一个Python扩展模块作为使用setuptools创建的鸡蛋分发。 以下是我的setup.py脚本: from setuptools import setup, Extension setup( name = "Hello", version = "0.1.0", ext_modules = [Extension('Hello', ['Source/Hello.cpp'])] ) 然后我用“setup.py b
from setuptools import setup, Extension
setup(
name = "Hello",
version = "0.1.0",
ext_modules = [Extension('Hello', ['Source/Hello.cpp'])]
)
然后我用“setup.py bdist_egg”构建egg,并用easy_install安装它。
一切正常。但有一个问题
源代码是在我运行“setup.py bdist_egg”时编译的,该egg包含pyd。
但是,我想创建一个包含源代码的egg,以及用户安装egg时要编译的源代码。
如何更改安装脚本?您可以创建一个源代码发行版:
python setup.py sdist
,该发行版将创建树的压缩快照。然后可以使用easy_install安装
但是,如果要公开分发源代码,最好使用文档后面的。创建源代码分发:
python setup.py sdist
,它将创建树的压缩快照。然后可以使用easy_install安装
不过,如果您想公开发布源代码,最好使用以下文档。Janne Karila的评论消除了我的困惑:
bdist = binary distribution
sdist = source distribution
bdist_egg = binary distribution as egg
没有sdist_蛋。詹妮·卡里拉的评论消除了我的困惑:
bdist = binary distribution
sdist = source distribution
bdist_egg = binary distribution as egg
没有sdist_egg。bdist是二进制分布的缩写,我不确定源分布是否可以是egg。bdist是二进制分布的缩写,我不确定源分布是否可以是egg。