Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Trouble making my first python .exe using pyinstaller.
I am trying to make a win 10 executable (.exe) from my script. I have installed pyinstall-3.2 and following the install document isn't so easy.
Any help getting this working will be appreciated.

PyInstaller is located at:
c:\pyInstaller-3.2 and hellowworld.bat are both at:


Here is the Bat file
python c:\pyInstaller-3.2\ --onefile --console --upx --tk
python c:\pyInstaller-3.2\PyInstaller\building\ helloworld.spec
Here is
#!/usr/bin/env python 

for i in xrange(1000): 
    print "Hello, World!"
Finally, here are the error messages:

C:\Users\Michael\Desktop\helloworld>python c:\pyInstaller-3.2\ --onefile --console --upx --tk usage: [-h] [-D] [-F] [--specpath DIR] [-n NAME] [-p DIR]                    [--hidden-import MODULENAME]                    [--additional-hooks-dir HOOKSPATH]                    [--runtime-hook RUNTIME_HOOKS] [--exclude-module EXCLUDES]                    [--key KEY] [-d] [-s] [--noupx] [-c] [-w]                    [-i <FILE.ico or FILE.exe,ID or FILE.icns>]                    [--version-file FILE] [-m <FILE or XML>] [-r RESOURCE]                    [--uac-admin] [--uac-uiaccess] [--win-private-assemblies]                    [--win-no-prefer-redirects]                    [--osx-bundle-identifier BUNDLE_IDENTIFIER]                    [--log-level LEVEL] [--upx UPX]                    scriptname [scriptname ...] error: argument --upx/-X/-K/--tk/-C/--configfile/--skip-configure/-o/--out/--buildpath: expected one argument C:\Users\Michael\Desktop\helloworld>python c:\pyInstaller-3.2\PyInstaller\building\ helloworld.spec Traceback (most recent call last):   File "c:\pyInstaller-3.2\PyInstaller\building\", line 27, in <module>     from .. import HOMEPATH, DEFAULT_DISTPATH, DEFAULT_WORKPATH ValueError: Attempted relative import in non-package C:\Users\Michael\Desktop\helloworld>pause Press any key to continue . . .
Simply install pyinstaller using pip
Then open a command promt, change the directory to the location of the .py file
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>cd /d c:\users\michael\desktop\helloworld\
then execute pyinstaller using
c:\users\michael\desktop\helloworld>pyinstaller --onefile --console --upx --tk
For certain uses you may edit the contents of myscript.spec (described under Using Spec Files). After you do this, you name the spec file to PyInstaller instead of the script:
c:\users\michael\desktop\helloworld>pyinstaller helloworld.spec
I got stuck on the second step.

here is the activity and error
Volume in drive C is OS
Volume Serial Number is A2D2-EFB5

Directory of c:\Users\Michael\Desktop\helloworld

12/08/2016  05:06 PM    <DIR>          .
12/08/2016  05:06 PM    <DIR>          ..
12/08/2016  03:20 PM               169 helloworld.bat
12/08/2016  02:43 PM                76
12/08/2016  05:06 PM                 0 pyinstaller
              3 File(s)            245 bytes
              2 Dir(s)  709,115,584,512 bytes free

c:\Users\Michael\Desktop\helloworld>pyinstaller --onefile --console --upx --tk
usage: pyinstaller [-h] [-v] [-D] [-F] [--specpath DIR] [-n NAME] [-p DIR]
                  [--hidden-import MODULENAME]
                  [--additional-hooks-dir HOOKSPATH]
                  [--runtime-hook RUNTIME_HOOKS] [--exclude-module EXCLUDES]
                  [--key KEY] [-d] [-s] [--noupx] [-c] [-w]
                  [-i <FILE.ico or FILE.exe,ID or FILE.icns>]
                  [--version-file FILE] [-m <FILE or XML>] [-r RESOURCE]
                  [--uac-admin] [--uac-uiaccess] [--win-private-assemblies]
                  [--osx-bundle-identifier BUNDLE_IDENTIFIER]
                  [--distpath DIR] [--workpath WORKPATH] [-y]
                  [--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEVEL]
                  [--upx UPX]
                  scriptname [scriptname ...]
pyinstaller: error: argument --upx/-X/-K/--tk/-C/--configfile/--skip-configure/-o/--out/--buildpath: expected one argument c:\Users\Michael\Desktop\helloworld>
Try executing with no options to begin with to see if it works like that
pyinstaller options
--upx-dir UPX_DIR requires a path to UPX utility (default: search the execution path)
is --tk a valid option I didn't spot it.
Yes, that ran okay and the the exe file was found in the dist/helloworld folder

and it ran so there must be something in the previous options that caused the error

one more question, at the end oif the original command there was a --tk

is tk supposed to be an executable somewhere?

Anyway, thanks for the help
Read the rest of my previous post Tongue
Oh yea, I see it now.

--tk came from a "simple" install document that got me to this point.

the path to UPX in set up on this system but removing --tk didn't help.

I removed the --upx and --tk and it worked.

Again, thanks for the help.
The manual is here, in case all else fails:
Thanks Larz60+

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Cannot Change Python script to exe using Pyinstaller omar_mohsen 3 150 Dec-19-2019, 01:05 PM
Last Post: buran
  Making a generalised CSV COPY script in Python Sandy7771989 3 392 Jul-05-2019, 11:02 PM
Last Post: Larz60+
  Error with using pyinstaller to convert python script in Mac OS Takeshio 2 1,794 Oct-19-2018, 02:42 PM
Last Post: Takeshio
  Trouble making an argument optional linuxnoob 2 824 Aug-31-2018, 01:52 AM
Last Post: linuxnoob
  compiling python using pyinstaller sabeesh90 0 846 Aug-16-2018, 09:58 AM
Last Post: sabeesh90
  [split] Trouble making my first python .exe using pyinstaller. esha09 5 2,509 Apr-21-2018, 09:37 PM
Last Post: snippsat
  Problems with PyInstaller with tkinter app on python 3.5 sealyons 10 10,312 Jun-16-2017, 08:19 PM
Last Post: sealyons

Forum Jump:

Users browsing this thread: 1 Guest(s)