【问题标题】:How to make a .deb file from Python如何从 Python 制作 .deb 文件
【发布时间】:2012-11-10 14:56:34
【问题描述】:
我想从我的 Python 文件中制作 .deb 包并包含图像文件。我的程序是一个使用wxPython 制作的简单聊天客户端。
如何制作易于制作的 .deb 包?
我的版本是Ubuntu 12.04(Precise Pangolin),Python是2.7.3版本,wxPython是2.8版本。
我的文件是wxchat.py 和聊天客户端的三个图像 (JPEG) 文件。
【问题讨论】:
标签:
python
wxpython
debian
deb
【解决方案1】:
如果您制作的 .deb 文件仅供内部使用(即不提交给 Debian 社区等),则有一个名为 stdeb 的工具:https://github.com/astraw/stdeb。您可以使用apt-get: sudo apt-get install python-stdeb 安装它。
如果你有setup.py,你可以通过这些命令创建一个.deb文件:
python setup.py --command-packages=stdeb.command sdist_dsc
cd deb_dist/packagename-versionname/
debuild -uc -us
cd -
可以在stdeb.cfg中指定依赖:
[DEFAULT]
Depends:
python-wxgtk2.8
# You can restrict versions of the packages
python-wxtools (>= 2.8)
# Note that comments should start from the first character of the line
【解决方案2】:
互联网上有很多资源描述了如何做到这一点:
您必须确保已包含运行包所需的依赖项。在您的情况下,它将是 wxPython 和您需要的任何其他不属于 Python 标准库的包。
如果您只想打包您的软件以进行分发,您可能需要考虑创建一个 Python 包并将其放在 http://pypi.python.org 上。您可以在CheeseShopTutorial 中了解如何执行此操作。它往往是一个更简单的过程,这意味着您可以在 Debian 系统之外分发到基于 rpm 的 Linux 安装和 Mac、Windows。