如何将python应用程序与外部python库打包在一起? [英] How can I package my python application with external python libraries?

查看:711
本文介绍了如何将python应用程序与外部python库打包在一起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的头衔清楚.我正在使用wxpython制作GUI,我希望它能够被打开,提取并使其在所有操作系统上都能正常工作.我能够通过在斜纹档案中找到一个名为twill的文件夹来包括斜纹,效果很好.但是,我无法弄清楚如何正确打包wxpython.

I hope my title was clear. I'm using wxpython for making a GUI and I want it to be able to be opened, extracted, and have it work on all operating systems. I was able to include twill by finding a folder called twill inside the twill archive, which worked fine. However, I'm unable to figure out how to correctly package wxpython.

我不使用任何一个. py2exe仅适用于Windows,bbfreeze似乎在Mac上不起作用(因此它不能跨平台使用)

I'm not using either. py2exe is only for windows, and bbfreeze doesn't seem to work on mac (so it's not cross platform)

推荐答案

不幸的是,没有一站式解决方案,因此单个可安装的可执行文件将在所有操作系统上运行.正确的解决方案实际上是为每个OS提供不同的安装程序或可执行文件.对于Windows,请使用py2exe;对于Mac,请使用py2app是一个不错的选择;对于Linux,您应该只为压缩包提供一个合理的setup.py(无论如何,前两个都需要).

Unfortunately, there's just no one stop solution so that a single installable executable will work across all operating systems. The right solution is really to provide a different installer or executable for each OS; For windows, use py2exe, for mac, py2app is a good choice, and for linux you should just provide a tarball with a reasonable setup.py (that you will need for the first two, anyway).

这篇关于如何将python应用程序与外部python库打包在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆