怎么把python文件变成exe,如何将多个python文件转换为EXE?

I am trying to convert my python application to an exe. I have seen things like py2exe and cx freeze, but they only compile one single py file. Can anyone help me? Thank you

解决方案

I currently use pyinstaller for building projects into single-executable files. These projects all contain multiple python (and some non-python) files that are all "built into" the exes.

That being said, even with multiple python files included, Marcus Müller is correct. There is one entry point for a given executable.

In summary, if you have multiple files as part of a single project, pyinstaller along with the other python bundlers will handle this scenario.

If you have multiple files and want them each to be their own executable file, you will need to treat each as its own 'project' and package each individually.

What platform(s) are you targeting? Can you describe the intended purpose of the files? Can you describe the intended usage of the files?

Posting an example of what you currently have, what behavior you are observing, and clarification on what is different between what you are expecting and what you are observing would definitely help others in guiding you towards the answer you desire.

Edit:

Well, I have a main python file that is referenced to a very brief config.py. The main file also accesses a few text files. Could I just combine the config and the main into one py file, and make that an executable, and will that executable still have access to the text files?

Your main python file would be your exe's entry point. If you import your config file into your main, pyinstaller should see the import and include it. On this line, verify your PATH environment variable, and insure your system knows where to find the bits it needs. If the text files are to be included as part of the built executable file, pyinstaller has the ability to include files into the build as well (example, include a database, a config, or a static data set). An example question describing including an icon file for a build: include-pyinstaller-icon

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值