r/learnpython • u/zaphodikus • Sep 24 '26
pyinstaller is not recognised as an internal command
I am On windows and have 3.13 installed
python --version
3.13.14
where python returns
C:\Program Files\Python313\python.exe
C:\Users\conrad.braam\.pyenv\pyenv-win\shims\python
C:\Users\conrad.braam\.pyenv\pyenv-win\shims\python.bat
I hate that visual studio has this shim, but I am ignoring the shim. (Yes that is me, it's no secret)
My path is correct, but there is no pyinstaller.exe in /scripts
python -m PyInstaller -v shows it's installed because it prints out a nice result
python -m PyInstaller -v
6.22.3
So I guess I could maybe fix my script to call python -m Pyinstaller somescript instead of just calling python somescript I'm just puzzled why is the package not installed correctly as a global package?
1
u/danielroseman Sep 24 '26
Why are you expecting an exe file? python -m will run the Python module, not an exe.
1
u/zaphodikus Sep 24 '26
There is an executable for all the tools that have a standalone launcher pytest for example has a standalone too in the /Scripts folder. Go have a gander in there :-)
Anyway I did solve it by uninstalling the package and installing it again, it must have been a AV problem or other.
1
u/Outside_Complaint755 Sep 24 '26
Both pip and PyInstaller are available directly from the command line in Windows due to putting an .exe in the scripts folder, with the assumption that the scripts folder is included in the System Path environment variable.
Pyinstaller directions say to run it like pip
> pyinstaller your_app_script.py
1
u/Educational_Virus672 Sep 24 '26
it is due to System path not recognizing i dont know if it work but try changeing the system variable by searching "edit system environment variables" and add the path with pyistaller and if that doesnt work either importing the "pyinstaller.__main__ as pim" and adding some stuff using
import PyInstaller.__main__ as pym
pym.run(['yourscriptname.py','--onefile'])
1
u/p3rdy Sep 24 '26
Run
python -m pip show pyinstallerand look at location. I'd bet it's under%APPDATA%\Python\Python313\site-packagesrather than Program Files.Python313 is in Program Files, which needs admin to write, so pip quietly fell back to a user install. The package imports fine, but the exe went to
%APPDATA%\Python\Python313\Scripts, which isn't onPATH, and isn't the Scripts dir you're looking in.Add that to
PATH, or use a venv, which also gets you clear of the pyenv shims.python -m PyInstalleris the better call from a script anyway, since it can't pick the wrong interpreter.