Python:使用 Pyinstaller 编译

发布于 2024-10-29 23:42:25 字数 3710 浏览 0 评论 0原文

所以我试图用 Pyinstaller 创建一个可执行的二进制文件。构建后,文件“warnpython.txt”将显示此消息。

W: no module named msvcrt (conditional import by subprocess)
W: no module named msvcrt (delayed import by getpass)
W: no module named rourl2path (conditional import by urllib)
W: no module named msvcrt (conditional import by getpass)
W: no module named _subprocess (conditional import by subprocess)
W: no module named AES (delayed, conditional import by archive)
W: no module named _scproxy (conditional import by urllib)
W: no module named org (top-level import by pickle)
W: no module named EasyDialogs (conditional import by getpass)
W: no module named SOCKS (top-level import by ftplib)
W: no module named _winreg (delayed import by urllib)
W: no module named nt (top-level import by ntpath)
W: no module named org (top-level import by copy)
W: no module named _emx_link (conditional import by os)
W: __all__ is built strangely at line 0 - __future__ (/usr/lib/python2.6/__future__.pyc)
W: __all__ is built strangely at line 0 - collections (/usr/lib/python2.6/collections.pyc)
W: delayed  exec statement detected at line 0 - collections (/usr/lib/python2.6/collections.pyc)
W: delayed  __import__ hack detected at line 0 - email (/usr/lib/python2.6/email/__init__.pyc)
W: delayed  __import__ hack detected at line 0 - encodings (/usr/lib/python2.6/encodings/__init__.pyc)
W: delayed  __import__ hack detected at line 0 - optparse (/usr/lib/python2.6/optparse.pyc)
W: delayed  exec statement detected at line 0 - socket (/usr/lib/python2.6/socket.pyc)
W: delayed conditional __import__ hack detected at line 0 - doctest (/usr/lib/python2.6/doctest.pyc)
W: delayed  exec statement detected at line 0 - doctest (/usr/lib/python2.6/doctest.pyc)
W: delayed conditional __import__ hack detected at line 0 - doctest (/usr/lib/python2.6/doctest.pyc)
W: __all__ is built strangely at line 0 - dis (/usr/lib/python2.6/dis.pyc)
W: delayed  eval hack detected at line 0 - os (/usr/lib/python2.6/os.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (/usr/lib/python2.6/unittest.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (/usr/lib/python2.6/unittest.pyc)
W: __all__ is built strangely at line 0 - tokenize (/usr/lib/python2.6/tokenize.pyc)
W: delayed  exec statement detected at line 0 - bdb (/usr/lib/python2.6/bdb.pyc)
W: delayed  eval hack detected at line 0 - bdb (/usr/lib/python2.6/bdb.pyc)
W: delayed  eval hack detected at line 0 - bdb (/usr/lib/python2.6/bdb.pyc)
W: delayed  __import__ hack detected at line 0 - pickle (/usr/lib/python2.6/pickle.pyc)
W: delayed  __import__ hack detected at line 0 - pickle (/usr/lib/python2.6/pickle.pyc)
W: delayed conditional exec statement detected at line 0 - iu (/home/zack/Desktop/pyinstaller-1.5-rc1/iu.pyc)
W: delayed conditional exec statement detected at line 0 - iu (/home/zack/Desktop/pyinstaller-1.5-rc1/iu.pyc)
W: delayed  eval hack detected at line 0 - gettext (/usr/lib/python2.6/gettext.pyc)
W: delayed conditional eval hack detected at line 0 - warnings (/usr/lib/python2.6/warnings.pyc)
W: delayed conditional __import__ hack detected at line 0 - warnings (/usr/lib/python2.6/warnings.pyc)
W: delayed  exec statement detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)
W: delayed  eval hack detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)
W: delayed  eval hack detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)

执行新制作的可执行文件后,我立即返回终端,就像进程已退出一样。当通过执行 py 脚本进行测试时,一切正常,只有当使用 Pyinstaller 编译时才会发生这种情况。警告文件是否给了我们任何线索?

So I'm trying to create a executable binary file with Pyinstaller. Upon building the file 'warnpython.txt' appears bearing this message.

W: no module named msvcrt (conditional import by subprocess)
W: no module named msvcrt (delayed import by getpass)
W: no module named rourl2path (conditional import by urllib)
W: no module named msvcrt (conditional import by getpass)
W: no module named _subprocess (conditional import by subprocess)
W: no module named AES (delayed, conditional import by archive)
W: no module named _scproxy (conditional import by urllib)
W: no module named org (top-level import by pickle)
W: no module named EasyDialogs (conditional import by getpass)
W: no module named SOCKS (top-level import by ftplib)
W: no module named _winreg (delayed import by urllib)
W: no module named nt (top-level import by ntpath)
W: no module named org (top-level import by copy)
W: no module named _emx_link (conditional import by os)
W: __all__ is built strangely at line 0 - __future__ (/usr/lib/python2.6/__future__.pyc)
W: __all__ is built strangely at line 0 - collections (/usr/lib/python2.6/collections.pyc)
W: delayed  exec statement detected at line 0 - collections (/usr/lib/python2.6/collections.pyc)
W: delayed  __import__ hack detected at line 0 - email (/usr/lib/python2.6/email/__init__.pyc)
W: delayed  __import__ hack detected at line 0 - encodings (/usr/lib/python2.6/encodings/__init__.pyc)
W: delayed  __import__ hack detected at line 0 - optparse (/usr/lib/python2.6/optparse.pyc)
W: delayed  exec statement detected at line 0 - socket (/usr/lib/python2.6/socket.pyc)
W: delayed conditional __import__ hack detected at line 0 - doctest (/usr/lib/python2.6/doctest.pyc)
W: delayed  exec statement detected at line 0 - doctest (/usr/lib/python2.6/doctest.pyc)
W: delayed conditional __import__ hack detected at line 0 - doctest (/usr/lib/python2.6/doctest.pyc)
W: __all__ is built strangely at line 0 - dis (/usr/lib/python2.6/dis.pyc)
W: delayed  eval hack detected at line 0 - os (/usr/lib/python2.6/os.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (/usr/lib/python2.6/unittest.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (/usr/lib/python2.6/unittest.pyc)
W: __all__ is built strangely at line 0 - tokenize (/usr/lib/python2.6/tokenize.pyc)
W: delayed  exec statement detected at line 0 - bdb (/usr/lib/python2.6/bdb.pyc)
W: delayed  eval hack detected at line 0 - bdb (/usr/lib/python2.6/bdb.pyc)
W: delayed  eval hack detected at line 0 - bdb (/usr/lib/python2.6/bdb.pyc)
W: delayed  __import__ hack detected at line 0 - pickle (/usr/lib/python2.6/pickle.pyc)
W: delayed  __import__ hack detected at line 0 - pickle (/usr/lib/python2.6/pickle.pyc)
W: delayed conditional exec statement detected at line 0 - iu (/home/zack/Desktop/pyinstaller-1.5-rc1/iu.pyc)
W: delayed conditional exec statement detected at line 0 - iu (/home/zack/Desktop/pyinstaller-1.5-rc1/iu.pyc)
W: delayed  eval hack detected at line 0 - gettext (/usr/lib/python2.6/gettext.pyc)
W: delayed conditional eval hack detected at line 0 - warnings (/usr/lib/python2.6/warnings.pyc)
W: delayed conditional __import__ hack detected at line 0 - warnings (/usr/lib/python2.6/warnings.pyc)
W: delayed  exec statement detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)
W: delayed  eval hack detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)
W: delayed  eval hack detected at line 0 - pdb (/usr/lib/python2.6/pdb.pyc)

Directly after executing the newly made executable file I'm dropped back to terminal as if the process has exited. When tested via executing the py script everything works fine it's only when it's compiled with Pyinstaller does this happen. Does the warning file give us any clues?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满地尘埃落定 2024-11-05 23:42:25

看起来您的系统中缺少 pywin32 模块。尝试安装 ActivePython 或安装 pywin32 模块。

http://python.net/crew/mhammond/win32/Downloads.html

looks like the module pywin32 is missing in your system. try install ActivePython or install the pywin32 module.

http://python.net/crew/mhammond/win32/Downloads.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文