鱼C论坛

 找回密码
 立即注册
查看: 1580|回复: 5

[已解决]pyinstaller打包文件

[复制链接]
发表于 2020-8-6 11:18:09 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
修改完spec文件,
  1. # -*- mode: python ; coding: utf-8 -*-
  2. import sys

  3. sys.setrecursionlimit(5000)
  4. block_cipher = None


  5. SETUP_DIR=r'C:\\Users\\ASUS\\Desktop\\python\\feijidazhan\\test\\imgae\\'

  6. a = Analysis(['main.py',
  7.                         'wo.py',
  8.                         'bag.py',
  9.                         'background.py'],
  10.              pathex=['C:\\Users\\ASUS\\Desktop\\python\\feijidazhan\\test'],
  11.              binaries=[],
  12.              datas=[(SETUP_DIR+'key.png','image'),
  13.                                         (SETUP_DIR+'man1.png','image'),
  14.                                         (SETUP_DIR+'man2.png','image'),
  15.                                         (SETUP_DIR+'man3.png','image'),
  16.                                         (SETUP_DIR+'room1.png','image'),
  17.                                         (SETUP_DIR+'room2.png','image'),
  18.                                         (SETUP_DIR+'room3.png','image'),
  19.                                         (SETUP_DIR+'room4.png','image'),
  20.                                         (SETUP_DIR+'room5.png','image'),
  21.                                         (SETUP_DIR+'room6.png','image'),
  22.                                         (SETUP_DIR+'room7.png','image'),],
  23.              hiddenimports=['pygame','traceback','sys','pygame.locals'],
  24.              hookspath=[],
  25.              runtime_hooks=[],
  26.              excludes=[],
  27.              win_no_prefer_redirects=False,
  28.              win_private_assemblies=False,
  29.              cipher=block_cipher,
  30.              noarchive=False)
  31. pyz = PYZ(a.pure, a.zipped_data,
  32.              cipher=block_cipher)
  33. exe = EXE(pyz,
  34.           a.scripts,
  35.           [],
  36.           exclude_binaries=True,
  37.           name='main',
  38.           debug=False,
  39.           bootloader_ignore_signals=False,
  40.           strip=False,
  41.           upx=True,
  42.           console=False )
  43. coll = COLLECT(exe,
  44.                a.binaries,
  45.                a.zipfiles,
  46.                a.datas,
  47.                strip=False,
  48.                upx=True,
  49.                upx_exclude=[],
  50.                name='main')
复制代码


执行完pyinstaller -D main.spec,
捕获2.PNG

点击出来的exe文件报错怎么办
捕获.PNG
最佳答案
2020-8-6 13:23:41
重装pyinstaller:
  1. pip uninstall pyinstaller
  2. pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
复制代码
用github的镜像
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-8-6 13:23:41 | 显示全部楼层    本楼为最佳答案   
重装pyinstaller:
  1. pip uninstall pyinstaller
  2. pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
复制代码
用github的镜像
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-8-6 14:42:41 | 显示全部楼层
本帖最后由 fytfytf 于 2020-8-6 15:36 编辑
xiaosi4081 发表于 2020-8-6 13:23
重装pyinstaller:
用github的镜像


重装完又打了一次包,点exe 捕获.PNG 这个报错怎么办
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-8-6 17:14:13 | 显示全部楼层
fytfytf 发表于 2020-8-6 14:42
重装完又打了一次包,点exe这个报错怎么办

你不是刚发了一样的贴吗
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-8-7 10:50:29 | 显示全部楼层
陈尚涵 发表于 2020-8-6 17:14
你不是刚发了一样的贴吗

之前网页卡住了,我以为没发出去
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-8-7 11:01:42 | 显示全部楼层
fytfytf 发表于 2020-8-7 10:50
之前网页卡住了,我以为没发出去

小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-25 05:36

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表