Pyinstaller is not recognized as internal or external command

Question:

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

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

C:Usersusername>

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

C:UsersusernameAppDataLocalProgramsPythonPython36-32Scripts>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:UsersusernameAppDataLocalProgramsPythonPython36-32Scripts>

How to solve this?

Asked By: user8533214

||

Answers:

You have to modify your User PATH environment variable to include C:Users[USERNAME]AppDataLocalProgramsPythonPython36-32Scripts.

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

Answered By: user10089632

For Python 3.7, you will have to add the Scripts folder from AppData/Roaming (%appdata%) to the PATH variable.

C:Users%USERNAME%AppDataRoamingPythonPython37Scripts

Answered By: Elijah

if you cannot do anything or you have less time, you can make the virtual environment and install pyinstaller there, then generate executable file

Answered By: Niraj Panchasara

Copy ‘pyinstaller.exe’ to the folder you have the .py file you want to convert. When you are done, just delete ‘pyinstaller.exe’. Good luck.

Answered By: Manan

Copy youe script folder’s path C:UsersusernameAppDataLocalProgramsPythonPython36-32Scripts and paste it in:
environment varibales> system varibales> path and save it.
Then restart your PC and try running pyinsatller from anywhere it will work.

Answered By: pratham82

Enter in Administrative Console: pip install pyinstaller

Answered By: Irick Barfield

Had exactly the same issue:

  • Locate your Python folder and go to PythonPython38Libsite-packages
  • From there delete the Pyinstaller module and Pyinstaller dis.info folder
  • Reinstall Pyinstaller using pip install pyinstaller
Answered By: Nizorrro

Goto – "C:UsersUsernameanaconda3Scripts" path and copy "pyinstaller.exe"
and paste it in the directory where you want to use pyinstaller, it worked for me

Answered By: Manoj Buddha
  1. Open command cmd from this path: ctrl+r, write "cmd" in box
  2. Uninstall pyinstaller: pip uninstall pyinstaller
  3. Install it again: pip install pyinstaller
  4. Use the pyinstaller by writing pyinstaller
Answered By: AT160

I found How we should fix this error :

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

We should enter this code in cmd pip install pyinstaller
if it is doesn’t work again you should go C:/user/pc name/Appdata (Appdata folder is hide)/python
now you should copy script folder and C:/program files/python39
and copy site package to C:/program files/python39/lib

then if you type pyinstaller in cmd you see it work

Answered By: Amir

First, you should check the configuration, ports, and active process.

After checking these processes, you can check the local folder.

You will find the pyinstaller inside this folder; there will be a pyinstaller.exe file.

Then set the path

C:Users[username]AppDataLocalProgramsPythonPython39Scripts,

C:Users[username]AppDataLocalProgramsPythonPython39.

After that, you can run the command pyinstaller --onefile -w filename.py

Answered By: karishma tejwani

First, you need to know where is the pyinstaller locates.
In my case, I ran

pip uninstall pyinstaller

Before it’s being uninstalled, it will ask you to confirm if you want to remove the following file…

c:usersUSERNAMEappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39scriptspyinstaller.exe

Great! Now by doing this, you know your path to pyinstaller. Simple type ‘No’ and exit the uninstallation as our purpose is just to get the path.
Now just add this path to the PATH variable.

c:usersUSERNAMEappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39scripts

For how to change your PATH variable. Check here

Answered By: David

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

Answered By: PJ3

If you don’t have pip in the PATH of your cmd, then you can run these commands in cmd for windows.

  1. python -m pip install pyinstaller – for installing pyinstaller.
  2. python -m pip uninstall pyinstaller – for uninstalling pyinstaller.
Answered By: Pawan Prajapati

If installing pyinstaller and creating the ‘path’ variables still does not work, u can use this workaround:

Locate pyinstaller.exe from possible python directory like
C:Users "UserName" AppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310Scripts

Copy it to the dir that you have the .py file you want to compile as .exe

Use following command in terminal:
.pyinstaller –onefile YOUR_FILE_NAME.py

Answered By: Bakalis Alexandros

This solution work for Python 3.9

First of all find the pyinstaller.exe location. To do this you could try this trick: (do not press ‘y’ just look at the above copy the path what you are looking for)

pip uninstall pyinstaller

Before typing anything, it will show you the path where the pyinstaller.exe is. After that copy the location and run this command on terminal: (it is an example)

python C:Users[YOUR_USER_NAME]AppData...Scriptspyinstaller.exe --onefile [your_script_name.py]
Answered By: Twister Joe

Oddly, for me changing the capitalization resolved the issue.
I typed python -m [scriptname] [args]. In [scriptname] I typed PyInstaller instead of pyinstaller and it actually worked. I tried both ways multiple times.

Answered By: BoyAcc

For me and on python version 3.9.12 the below command worked. The ‘P’ and ‘I’ in PyInstaller is capital. Also, I reinstalled the python package. Please see below the steps.

  1. python -m pip uninstall pyinstaller — for uninstalling the python package
  2. python -m pip install pyinstaller — for installing the python package
  3. python -m PyInstaller — and followed by rest of the attributes.
Answered By: Rishabh Aher

If you are using python 3.10 or higher, chance are that the pyinstaller is not added to your Path variables. To avoid all of that setup, you can simply run

python -m PyInstaller [path to your file] [args]

For example I ran

python -m PyInstaller ./frontend.py --onefile
Answered By: Faraz Zaidi
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.