V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
yumijie
V2EX  ›  Python

用 pyinstaller 打包生成 exe 后,执行时出现 Failed to execute script 错误

  •  
  •   yumijie · 2016-06-20 16:35:22 +08:00 · 18475 次点击
    这是一个创建于 2875 天前的主题,其中的信息可能已经有所发展或是发生改变。
    os:win7(32bit)
    python3.4.0
    pyinstaller3.2

    在 idle 下执行没问题.
    3 条回复    2016-06-21 18:57:18 +08:00
    yumijie
        1
    yumijie  
    OP
       2016-06-20 16:37:29 +08:00
    这是我的代码:
    # -*- coding: utf-8 -*-
    from tkinter import *

    root = Tk()
    # 80x80 代表了初始化时主窗口的大小, 0 , 0 代表了初始化时窗口所在的位置
    root.geometry('80x80+10+10')

    # 填充方向
    '''
    Label(root, text = 'l1', bg = 'red').pack(fill = Y)
    Label(root, text = 'l2', bg = 'green').pack(fill = BOTH)
    Label(root, text = 'l3', bg = 'blue').pack(fill = X)


    # 左右布局
    Label(root, text = 'l1', bg = 'red').pack(fill = Y, side = LEFT)
    Label(root, text = 'l2', bg = 'green').pack(fill = BOTH, side = RIGHT)
    Label(root, text = 'l3', bg = 'blue').pack(fill = X, side = LEFT)

    # 绝对布局
    l4 = Label(root, text = 'l4')
    l4.place(x = 3, y = 3, anchor = NW)
    '''

    # Grid 网格布局
    l1 = Label(root, text = 'l1', bg = 'red')
    l2 = Label(root, text = 'l2', bg = 'blue')
    l3 = Label(root, text = 'l3', bg = 'green')
    l4 = Label(root, text = 'l4', bg = 'yellow')
    l5 = Label(root, text = 'l5', bg = 'purple')

    l1.grid(row = 0, column = 0)
    l2.grid(row = 1, column = 0)
    l3.grid(row = 1, column = 1)
    l4.grid(row = 2 )
    l5.grid(row = 0, column = 3)

    root.mainloop()
    byteli
        2
    byteli  
       2016-06-21 16:41:01 +08:00
    没有 3 的环境没法测试,可以试试 py2exe ,不过 py3 就不晓得支持不支持了
    yumijie
        3
    yumijie  
    OP
       2016-06-21 18:57:18 +08:00
    @byteli py2exe 不支持

    除了 pyinstaller 比较好地支持 py3 其他几种打包工具对 py3 都支持不好
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2382 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:45 · PVG 19:45 · LAX 04:45 · JFK 07:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.