0

I have installed the Pyinstaller pip correctly and I want to use Pyinstaller to create a .exe file, but my VSCode Powershell terminal throws an error when I run the following command pyinstaller -W myfile.py

The term 'pyinstaller' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

  • pyinstaller -W myfile.py
  •   + CategoryInfo          : ObjectNotFound: (pyinstaller:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

I have done some online research, but I haven't found someone with the same error using Pyinstaller. So I would really appreciate your help.

  • To be able to call a native command using this syntax its directory path must be added to the `path` environment variable. Enter `$env:path` to verify. Alternatively you can specify fully qualified path like this: `& $variableContainingFullPath arguments` – zett42 Dec 04 '20 at 07:55
  • I think you are right and I don't have my Pyinstaller path as an environment variable, but I don't know how to add the directory into it. Should I add the Pyinstaller directory (which is inside a Python39/Lib/site-packages/ path) as an environment variable? – Emilio Contreras Dec 04 '20 at 08:09
  • Append the directory path, where Pyinstaller is located, to the `path` environment variable, separated by `;` – zett42 Dec 04 '20 at 09:18
  • @Emilio Contreras -Please check the environment variables of Python currently in use, you could refer to this link: [pyinstaller-is-not-recognized-as-internal-or-external-command](https://stackoverflow.com/questions/45951964/pyinstaller-is-not-recognized-as-internal-or-external-command) – Jill Cheng Dec 04 '20 at 09:25
  • Are you using virtual environments or something similar in VS Code? If you activate the virtual environment in VS Code and install pyinstaller there, it may help clear this type of confusion. – Jason Cook Dec 04 '20 at 12:40
  • 1
    @zett42 Thank you so much, I have solved the issue. This was caused due to an error in the installation procedure. I wasn't installing Pyinstaller with the correct system permissions, so I was not getting my pyinstaller.exe anywhere. I had to run `pip install pyinstaller --user`, and I got the correct exe files installed in my Python39/Scripts folder. – Emilio Contreras Dec 04 '20 at 17:30
  • I encourage you to [answer your own question](https://stackoverflow.com/help/self-answer), once you have 15 rep. – zett42 Dec 04 '20 at 17:59

0 Answers0