Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyinstaller is not recognized as internal or external command

I am trying to use pyinstaller in cmd but I receive error:

C:\Users\username>pyinstaller
'pyinstaller' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\username>

When I use this command in the Scripts folder in python , it works:

C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts>pyinstaller
usage: pyinstaller [-h] [-v] [-D] [-F] [--specpath DIR] [-n NAME]
                   [--add-data <SRC;DEST or SRC:DEST>]
                   [--add-binary <SRC;DEST or SRC:DEST>] [-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]
                   [--distpath DIR] [--workpath WORKPATH] [-y]
                   [--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEVEL]
                   [--upx UPX]
                   scriptname [scriptname ...]
pyinstaller: error: the following arguments are required: scriptname

C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts>

How to solve this?

like image 870
user8533214 Avatar asked Aug 30 '17 04:08

user8533214


People also ask

Why my PyInstaller is not working?

The most common reason a PyInstaller package fails is that PyInstaller failed to bundle a required file. Such missing files fall into a few categories: Hidden or missing imports: Sometimes PyInstaller can't detect the import of a package or library, typically because it is imported dynamically.


2 Answers

You have to modify your User PATH environment variable to include C:\Users\[USERNAME]\AppData\Local\Programs\Python\Python36-32\Scripts.

For how to add/modify your PATH environment variables, see this.

like image 158
user10089632 Avatar answered Oct 13 '22 19:10

user10089632


I did correctly configured my script path, I had to run python -m PyInstaller script.py in order for it to work

For every script I have to follow this pattern, python -m [script name] [args]

python version 3.10.0

like image 13
PJ3 Avatar answered Oct 13 '22 19:10

PJ3