cx_freeze python single file?

2019-02-01 07:35发布

I've been using cx_freeze for a while now and there is one thing I've really wanted to do: put ALL of the files into ONE executable that I can distribute. It's not really user friendly to send around a folder filled with 30 files, all in the same directory. How can I accomplish this? Thanks.

3条回答
欢心
2楼-- · 2019-02-01 08:07

You can use 'bdist_msi' instead of 'build'. This will create a dist folder in the directory with a single setup application.

http://cx-freeze.readthedocs.io/en/latest/distutils.html

查看更多
神经病院院长
3楼-- · 2019-02-01 08:14

It is not supported in cx_freeze. There was discussion about it on mailing list. As I recall, the author stated that others (PyInstaller, Py2Exe) use some dirty hacks to achieve that. Some anti-virus programs can consider that behavior as a virus also.

I used PyInstaller for some time, but went back to cx_freeze because of Python 2.7 support. I pack everything using Inno Setup, so it is easy to distribute. Depends if you use Windows or not.

查看更多
太酷不给撩
4楼-- · 2019-02-01 08:26

Isn't this what bbfreeze does?

Tutorial here: http://www.blog.pythonlibrary.org/2010/08/19/a-bbfreeze-tutorial-build-a-binary-series/

It's actually not that hard to roll your own with Python zipimport http://docs.python.org/library/zipimport.html

You may prefer to use something like UPX which is a more general solution, not Python only. http://upx.sourceforge.net/

查看更多
登录 后发表回答