{"id":408,"date":"2017-09-01T11:50:08","date_gmt":"2017-09-01T11:50:08","guid":{"rendered":"http:\/\/buklijas.info\/blog\/?p=408"},"modified":"2017-07-23T16:00:55","modified_gmt":"2017-07-23T16:00:55","slug":"make-standalone-executable-from-python-code-with-pyinstaller","status":"publish","type":"post","link":"http:\/\/buklijas.info\/blog\/2017\/09\/01\/make-standalone-executable-from-python-code-with-pyinstaller\/","title":{"rendered":"Make standalone executable from Python code with PyInstaller"},"content":{"rendered":"
Published on:<\/strong> 01.09.2017<\/p>\n I wanted to create single file that person could run on Windows machine, from my Pythone code.<\/p>\n After some investigation I found PyInstaller<\/a> and 1 hour later I had my EXE file from Python code.<\/p>\n Process for generating EXE files from Python code with PyInstaller<\/a> was quite easy, at least from my experience.<\/p>\n I have used it on Windows 7 64-bit and had no problems.<\/p>\n My program was one file script with 300 line and dependencies to docopt<\/a> and pyautogui<\/a>.<\/p>\n This will install PyInstaller This will generate script.exe in dist directory After this you have your EXE program.<\/p>\n Here I have used If you just use pyinstaller script.py, with out If you use Uncompression is described in details in official documentation<\/a>, temporary directory for uncompression in Windows is %TEMP%<\/a>.<\/p>\n Some other solutions:Steps for generating exe file with PyInstaller<\/h3>\n
\npip install pyinstaller<\/code><\/p>\n
\npyinstaller --onefile script.py<\/code><\/p>\n
How PyInstaller is working<\/h3>\n
--onefile<\/code> option for PyInstaller what will make one file EXE program.<\/p>\n
--onefile<\/code> option, than in dist folder you will get folder script with EXE file and all additional files for your EXE file to work.<\/p>\n
--onefile<\/code> option, then your one file EXE program need every time to uncompresses all files every time when it starts.<\/p>\n
\nhttp:\/\/nsis.sourceforge.net\/Main_Page<\/a>
\nhttp:\/\/nuitka.net\/<\/a>
\nhttps:\/\/pypi.python.org\/pypi\/pynsist<\/a>
\nhttps:\/\/cx-freeze.readthedocs.io\/en\/latest\/<\/a>
\nhttp:\/\/www.py2exe.org\/<\/a><\/p>\n