Python Pyinstaller可以';t将我的DLL复制到MEIPASS
所以我一直在不停地尝试用python脚本创建一个可执行文件 在调试模式下运行时:Python Pyinstaller可以';t将我的DLL复制到MEIPASS,python,tensorflow,exe,pyinstaller,Python,Tensorflow,Exe,Pyinstaller,所以我一直在不停地尝试用python脚本创建一个可执行文件 在调试模式下运行时: pyinstaller emotions.spec 一切正常,没有警告,没有错误。。。只有一个奇怪的信息行: 12047信息:distutils:重定目标为非venv dir 'C:\Dev\Python35\Lib\distutils' 我不知道这是否意味着什么 我的规范文件: # -*- mode: python -*- block_cipher = None a = Analysis(['emo
pyinstaller emotions.spec
一切正常,没有警告,没有错误。。。只有一个奇怪的信息行:
12047信息:distutils:重定目标为非venv dir
'C:\Dev\Python35\Lib\distutils'
我不知道这是否意味着什么
我的规范文件:
# -*- 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')
# -*- 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')
即时通讯使用:
Python3.5.0在virtualenv和
Pyinstaller 3.3.1
当我尝试运行/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\u MEI9402,里面还有其他文件,比如数据pyinstaller也应该捆绑在一起
我看过这些其他问题,但它们要么没有帮助,要么我不知道如何使用提供的“修复”
例如,这个:
我不明白我应该把写在大多数答案上的代码片段复制到哪里
注意:我在这个项目上使用tensorflow,所以我需要Python3.5或3.6
注2:我已经尝试过py2exe
提前非常感谢 这里的帖子所有者。。。所以我不知道为什么它会被修复,但我将它改回了.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')
# -*- 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')
我跑了:
pyinstaller --onedir emotions.spec
希望这对别人有帮助