pyinstaller not create single exe - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: pyinstaller not create single exe (/thread-4388.html) |
pyinstaller not create single exe - buran - Aug-12-2017 following this thread https://python-forum.io/Thread-Have-you-used-pynsist I decided to try pyinstaller. I want single exe + my config.ini file, but I get a bunch of files, despite that I specify --onefile option. any advise?apart from not being single exe, it works just fine. RE: pyinstaller not create single exe - snippsat - Aug-12-2017 What command do you use? Should be pyinstaller -F --onefile your.py After it should be one your.exe file in dist folder.
RE: pyinstaller not create single exe - buran - Aug-12-2017 Hm... I was trying pyinstaller --onefile myfile.spec and pyinstaller -F myfile.spec Note, myfile.spec was created first by running pyinstaller myfile.py (without --onefile option, because this was recommended - create one folder, then if it works - one file) and the I changed it to include the config.ini, like this# -*- mode: python -*- block_cipher = None a = Analysis(['tms.py'], pathex=['c:\\Dropbox\\TMS'], binaries=, datas=[('config.ini', '.') ], 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, exclude_binaries=True, name='tms', debug=False, strip=False, upx=True, console=True ) coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, name='tms')after now running again with --onefile: pyinstaller --onefile myfile.py it creates following spec file# -*- mode: python -*- block_cipher = None a = Analysis(['tms.py'], pathex=['c:\\Dropbox\\TMS'], binaries=, datas=[('config.ini','.')], 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='tms', debug=False, strip=False, upx=True, console=True )as a result onefile exe is created. note that coll part is missing - this was my mistake.However it does not include config.ini in the dist folder - even after I added config.ini in a.datas and run pyinstaller with .spec file .I have to move it myself. Thanks. RE: pyinstaller not create single exe - hbknjr - Aug-13-2017 Make sure the config.ini file path is given relative to the spec file. Something like: data's = [('folder/config.ini','.')]you can also try and replace '.'with some foldername to see if that folder is created or not. |