Pyinstaller无法将我的dll复制到MEIPASS

问题描述 投票:0回答:1

所以我试着不停地用python脚本创建一个可执行文件我有......

当我在调试模式下运行时:

pyinstaller emotions.spec

一切运行得很好,没有警告,没有错误...只有一个奇怪的INFO线:

12047 INFO:distutils:重定向到非venv目录'C:\ Dev \ Python35 \ Lib \ distutils'

我不知道这是否表明任何事情

我的spec文件:

    # -*- mode: python -*-

block_cipher = None

a = Analysis(['emotions.py'],
             pathex=['.',
             'C:\\Users\\tijuk\\Envs\\vis_p3.5\\Lib\\site-packages\\scipy\\extra-dll'
             ],
             binaries=[],
             datas=[
                ('checkpoints\\epoch_75.hdf5','.\\checkpoints'),
                ('haarcascade_frontalface_default.xml','.'),
                ('gifs\\sad\\*', '.\\gifs\\sad'),
                ('gifs\\happy\\*', '.\\gifs\\happy'),
                ('gifs\\neutral\\*', '.\\gifs\\neutral'),
                ('gifs\\scared\\*', '.\\gifs\\scared'),
                ('gifs\\sunglass\\*', '.\\gifs\\sunglass'),
                ('gifs\\surprised\\*', '.\\gifs\\surprised')
                ],
             hiddenimports=['scipy._lib.messagestream'],
             hookspath=None,
             runtime_hooks=None,
             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,
          exclude_binaries=True,
          name='emotions',
          debug=True,
          strip=False,
          upx=True,
          onedir=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='emotions')

我在virtualenv和Pyinstaller 3.3.1上使用:Python 3.5.0

当我尝试运行/dist/emotions/emotions.exe时,我收到以下错误:

[940] PyInstaller Bootloader 3.x
[940] LOADER: executable is C:\Users\tijuk\Projects\Vision\dist\emotions\emotions.exe
[940] LOADER: homepath is C:\Users\tijuk\Projects\Vision\dist\emotions
[940] LOADER: _MEIPASS2 is NULL
[940] LOADER: archivename is C:\Users\tijuk\Projects\Vision\dist\emotions\emotions.exe
[940] LOADER: Extracting binaries
[940] LOADER: Executing self as child
[940] LOADER: set _MEIPASS2 to C:\Users\tijuk\AppData\Local\Temp\_MEI9402
[940] LOADER: Setting up to run child
[940] LOADER: Creating child process
[940] LOADER: Waiting for child process to finish...
[3280] PyInstaller Bootloader 3.x
[3280] LOADER: executable is C:\Users\tijuk\Projects\Vision\dist\emotions\emotions.exe
[3280] LOADER: homepath is C:\Users\tijuk\Projects\Vision\dist\emotions
[3280] LOADER: _MEIPASS2 is C:\Users\tijuk\AppData\Local\Temp\_MEI9402
[3280] LOADER: archivename is C:\Users\tijuk\Projects\Vision\dist\emotions\emotions.exe
[3280] LOADER: SetDllDirectory(C:\Users\tijuk\AppData\Local\Temp\_MEI9402)
[3280] LOADER: Already in the child - running user's code.
[3280] LOADER: Python library: C:\Users\tijuk\AppData\Local\Temp\_MEI9402\python35.dll
Error loading Python DLL 'C:\Users\tijuk\AppData\Local\Temp\_MEI9402\python35.dll'.
LoadLibrary: Não foi possível encontrar o módulo especificado.
[940] LOADER: Back to parent (RC: -1)
[940] LOADER: Doing cleanup
[940] LOADER: Freeing archive status for C:\Users\tijuk\Projects\Vision\dist\emotions\emotions.exe

LoadLibrary:无法找到指定的模块

手段

LoadLibrary:无法找到指定的模块

如果我改为Python3.6,我会得到同样的东西,但对于python36.dll。

我查了一下这个... \ Appdata \ Local \ Temp_MEI9402并且还有其他文件,比如数据pyinstaller也应该捆绑在一起。

我已经查看了其他这些问题,但是他们要么没有帮助,要么我无法理解如何使用例如这个提供的“修复”:qazxsw poi

在哪里我无法理解我应该在哪里复制那些写在大多数答案上的代码片段。

注意:我在这个项目上使用tensorflow,所以我需要Python3.5或3.6

注2:我已经尝试过py2exe

非常感谢你提前!

python tensorflow exe pyinstaller
1个回答
0
投票

帖子的所有者在这里......所以...我不知道为什么它被修复,但我把它改回了我的.spec文件的旧版本:

Bundling data files with PyInstaller (--onefile)

我跑了:

# -*- mode: python -*-

block_cipher = None

a = Analysis(['emotions.py'],
             pathex=['.','C:\\Users\\tijuk\\Envs\\vis_p3.5\\Lib\\site-packages\\scipy\\extra-dll'],
             binaries=[],
             datas=[
                ('checkpoints\\epoch_75.hdf5','.\\checkpoints'),
                ('haarcascade_frontalface_default.xml','.'),
                ('png\\*','.\\png'),
                ('gifs\\sad\\*', '.\\gifs\\sad'),
                ('gifs\\happy\\*', '.\\gifs\\happy'),
                ('gifs\\neutral\\*', '.\\gifs\\neutral'),
                ('gifs\\scared\\*', '.\\gifs\\scared'),
                ('gifs\\sunglass\\*', '.\\gifs\\sunglass'),
                ('gifs\\surprised\\*', '.\\gifs\\surprised')
                ],
             hiddenimports=['scipy._lib.messagestream'],
             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,
          exclude_binaries=True,
          name='emotions',
          debug=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='emotions')

希望这有助于某人

© www.soinside.com 2019 - 2024. All rights reserved.