将python程序打包后失败提示 failed to execute script xxx

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将python程序打包后失败提示 failed to execute script xxx相关的知识,希望对你有一定的参考价值。

参考技术A 一、用快捷键 ALT+F12 打开终端 

二、在终端界面中输入“pip install pyinstaller”,安装PyInstaller

三、确定安装成功之后,在终端中输入“pyinstaller -F -w 文件名”,回车后开始打包文件:

这里解释下 -F 和 -w 这两个属性有什么作用:

-F 是用于将所有的支持文件全部都打包在一起,不显示其他的依赖文件(如果没有这个属性,你会发现所有生成的、所需支持的依赖文件会全部在文件夹下)

-w 在程序运行的过程中隐藏后台控制的黑窗口

四、此时打开exe文件,提示failed to execute script xxx

根据百度安装了下 pyqt5==5.9.2  安装到一半提示time out (命令 pip install pyqt5==5.9.2)

又重新进行安装 ,不限版本   pip install pyqt==5.9.2 安装成功

参考百度安装环境:

然后运行命令:

pyinstaller -D code.py

pyinstaller -F code.py

pyinstaller -w -F code.py

再次运行exe文件就成功了,具体原因,不知道为啥成功了,多试试。

使用python的数列相关的知识,书写购物车程序

要求

1、启动程序后让用户输入余额,并打印商品列表
2、用户通过输入编号购买商品
3、用户选择商品购买后,根据余额判断成功或者失败,给出对应提示
4、可以随时退出,退出后打印账号余额以及购买的商品列表

构思

1、首先,用户余额需要进行存储,用户购买的物品需要进行存储在数组中
2、用户购买成功后,将购买的物品放入物品集合,并用总金额减去余额
3、如果失败,给出失败提示,并打印余额
4、用户选择继续后,无论成功失败,都可以继续购买

代码

# 用户输入工资
balance = int(input("Please input balance:"))
# 定义衣服的数组
clothes = [["pants",100],["T-shirt",50],["skirt",20]]
# 个人所得,包括金钱和获取的物品
haveGoods = [balance,[]]
flag = True
while flag:
# 打印衣服列表
print("The clothes list is as follows")
print("______clothesList______")
i = 1;
for c in clothes:
print(‘The number:‘,i,":",c)
i += 1

# 用户输入商品编号
code = int(input("Please choose the number:"))
# 判断钱是否够用
if clothes[code-1][1] <= haveGoods[0]:
# 在自己的购物清单中加入已购物品
haveGoods[1].append(clothes[code-1])
# 减去花费的金钱
haveGoods[0] -= clothes[code-1][1]
print("You have successfully purchased!")
print("Your account balance is:",haveGoods[0])
else:
print("Your account balance is insufficient!")
print("Your account balance is:",haveGoods[0])
judge = input("You can press any button to continue,or input ‘n‘ to leave:")
if judge == "n":
flag = False
print("Your account balance is:",haveGoods[0])
print("Your shopping list is as follows:")
print("______clothesList______")
for h in haveGoods[1]:
print(h)


以上是关于将python程序打包后失败提示 failed to execute script xxx的主要内容,如果未能解决你的问题,请参考以下文章

Python 使用pyinstaller打包程序失败提示找不到c盘的某个dll文件解决方法,FileNotFoundError: [WinError 2] 系统找不到指定的文件

python安装失败提示“one or more issues caused the setup to fail . Please fix the issues and then retry set

jenkins主从从服务器发布脚本执行成功但总提示失败 FATAL: Remote call on XXXX failed

flash loader demo下载程序,最后一步失败,(stm32,vc6t)提示:fail:unable to download data

UE4 Android平台运行报错:Assertion failed:OpenGLES2.h

remote: Coding 提示: Authentication failed问题解决