python把项目变成可执行文件_如何使用所有其他脚本将python项目转换为可执行文件?...

I know there have been a bunch of questions already asked regarding this but none of them really helped me. Let me explain the whole project scenario so that I provide a better clarity to my problem. The directory structure is somewhat like this shown below:

Project Directory Layout

I need to convert this whole GUI based project (The main file is using Tkinter module to create GUI) into main.exe which I can share with others while making sure that all the additional files work exactly the same way it is working now when I run this main.py via Command Prompt. When I use this command with pyinstaller -

"pyinstaller --onefile --noconsole main.py"

It creates main.exe which shows "Failed to execute script" on running. Please provide me a detailed explanation on what should I do to achieve what I have stated above. Thank you in advance.

解决方案

pyinstaller uses a few dirty tricks to compress a bunch of files into one

I recommend using cx_Freeze instead along with inno setup installer maker

do pip install cx_Freeze to install that and go here for inno setup

then copy the following into a file named setup.py in the same folder as your project

from cx_Freeze import setup, Executable

setup(name = "YOUR APP NAME" ,

version = "1.0.0" ,

description = "DESCRIPTION" ,

executables = [Executable("PYTHON FILE", base = "Win32GUI")]

)

lastly run python setup.py build

if you want as onefile download this file here

just edit the file a bit and use inno compiler to make into installer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值