PyInstaller创建工作可执行文件的问题

时间:2018-01-16 18:17:47

标签: anaconda pyqt5 python-3.5 pyinstaller spyder

我创建了一个Windows 64位桌面应用程序,当我从Spyder(Anaconda的一部分)运行它并且我使用pyinstaller 3.3.1(使用Anaconda中的终端)创建它时它可以工作一个EXE,我使用的CLI代码是:

pyinstaller --clean -w -F -i" C:\ Users \ User \ Python_program \ icon.ico" program.pyw

我去了'' dist'文件夹并双击' program.exe'我收到这个错误:

enter image description here

' program.spec'文件:

# -*- mode: python -*-

block_cipher = None


a = Analysis(['program.pyw'],
             pathex=['C:\\Users\\User\\Python_program'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)

pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name='program',
          debug=False,
          strip=False,
          upx=True,
          runtime_tmpdir=None,
          console=False , icon='C:\\Users\\User\\Python_program\\icon.ico')

在' warnprogram.txt'在' build / program'文件夹我得到了这个缺少模块的列表:

missing module named resource - imported by posix, C:\Users\User\Python_program\program.pyw
missing module named posix - imported by os, C:\Users\User\Python_program\program.pyw
missing module named _posixsubprocess - imported by subprocess, C:\Users\User\Python_program\program.pyw
missing module named 'org.python' - imported by pickle, C:\Users\User\Python_program\program.pyw, xml.sax
missing module named clr - imported by pyreadline.clipboard.ironpython_clipboard, pyreadline.console.ironpython_console, C:\Users\User\Python_program\program.pyw
missing module named IronPythonConsole - imported by pyreadline.console.ironpython_console, C:\Users\User\Python_program\program.pyw
missing module named StringIO - imported by pyreadline.py3k_compat, C:\Users\User\Python_program\program.pyw
missing module named System - imported by pyreadline.clipboard.ironpython_clipboard, pyreadline.keysyms.ironpython_keysyms, pyreadline.console.ironpython_console, pyreadline.rlmain, C:\Users\User\Python_program\program.pyw
missing module named sets - imported by pyreadline.keysyms.common, C:\Users\User\Python_program\program.pyw
missing module named startup - imported by pyreadline.keysyms.common, pyreadline.keysyms.keysyms, C:\Users\User\Python_program\program.pyw
missing module named console - imported by pyreadline.console.ansi, C:\Users\User\Python_program\program.pyw
excluded module named _frozen_importlib - imported by importlib, importlib.abc, C:\Users\User\Python_program\program.pyw
missing module named _frozen_importlib_external - imported by importlib._bootstrap, importlib, importlib.abc, C:\Users\User\Python_program\program.pyw
missing module named _winreg - imported by platform, C:\Users\User\Python_program\program.pyw
missing module named _scproxy - imported by urllib.request
missing module named java - imported by platform, C:\Users\User\Python_program\program.pyw
missing module named 'java.lang' - imported by platform, C:\Users\User\Python_program\program.pyw, xml.sax._exceptions
missing module named vms_lib - imported by platform, C:\Users\User\Python_program\program.pyw
missing module named termios - imported by tty, C:\Users\User\Python_program\program.pyw, getpass
missing module named grp - imported by shutil, tarfile, C:\Users\User\Python_program\program.pyw
missing module named pwd - imported by posixpath, shutil, tarfile, http.server, webbrowser, C:\Users\User\Python_program\program.pyw, netrc, getpass
missing module named ce - imported by os, C:\Users\User\Python_program\program.pyw
missing module named _dummy_threading - imported by dummy_threading, C:\Users\User\Python_program\program.pyw
missing module named org - imported by copy, C:\Users\User\Python_program\program.pyw

我出错了什么,如何纠正?任何建议,以前相关问题的链接(我已经搜索了Stack Overflow但没有任何与此特定问题有关的结果)将不胜感激。感谢

更新

我在cli中使用了这段代码:

pyinstaller --clean -w -F --paths C:\ Users \ User \ Anaconda3 \ Library \ bin -i" C:\ Users \ User \ Python_program \ icon.ico" program.py

这是生成的spec文件:

# -*- mode: python -*-

block_cipher = None


a = Analysis(['program.py'],
         pathex=['C:\\Users\\User\\Anaconda3\\Library\\bin', 'C:\\Users\\User\\Python_program'],
         binaries=[],
         datas=[],
         hiddenimports=[],
         hookspath=[],
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=False,
         cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
         cipher=block_cipher)
exe = EXE(pyz,
      a.scripts,
      a.binaries,
      a.zipfiles,
      a.datas,
      name='program',
      debug=False,
      strip=False,
      upx=True,
      runtime_tmpdir=None,
      console=False , icon='C:\\Users\\User\\Python_program\\icon.ico')

我仍然得到与以前相同的结果,但我不知道该做什么。有人可以就下一步使用PyInstaller提供一些建议吗?

0 个答案:

没有答案