Python Forum
Trying to use pyinstaller results in a syntax error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to use pyinstaller results in a syntax error
#1
I managed to install Pyinstaller although it did say on installation.

---
Output:
> WARNING: The scripts pyi-archive_viewer. exe, pyi-bindepend. exe, pyi-grab_version. exe, pyi-makespec. exe, pyi-set_version. exe and pyinstaller. exe are installed in 'C:\\Users\\maben\\AppData\\Local\\Programs\\Python\\Python312\\Scripts' which is not on PATH. > > Consider adding this directory to PATH or, if you prefer to suppress this warning, use -- no-warn-script-location.'
---

I've tried playing around with PATH (including adding the path outlined in the warning above) but haven't had much success.

In a .py file I'm trying to run:

-----
import pyinstaller

pyinstaller "C:\Python\w3\factorial_play.py"
-----

But I always get an 'Invalid Syntax' alert, highlighted on the first double quotes. I've previously tried just putting the file name in, but would then get it highlighted on the 'f' of 'factorial_play.py'.
buran write Apr-15-2026, 08:21 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply
#2
It looks like there is some confusion on how to use pyinstaller.

Have a look ate the docs:

1. if you want to use it as command line tool: https://pyinstaller.org/en/stable/usage.html

2. if you want to run it from within your own python code: https://pyinstaller.org/en/stable/usage....ython-code
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Follow this and add too Environment Variables Path
C:\Users\\maben\AppData\Local\Programs\Python\Python312
C:\Users\maben\AppData\Local\\Programs\Python\Python312\Scripts
Restart Pc.
Then open cmd and test that pip and pyinstaller work,which both are in Scripts folder(that's why you need to add to Environment Path).
C:\code>pyinstaller --version
6.17.0

C:\code>pip --version
pip 25.2 from C:\Python313\Lib\site-packages\pip (python 3.13)
So when it work it will give back version,and you use Pyinstaller from command line eg:
C:\code>pyinstaller --onefile myscript.py
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  POST Syntax error amplay 0 1,386 Aug-07-2024, 02:43 PM
Last Post: amplay
  is this really a syntax error? Skaperen 4 2,551 May-25-2024, 07:31 AM
Last Post: snippsat
  World Clock syntax error OscarBoots 1 1,759 May-03-2024, 05:20 AM
Last Post: snippsat
  Syntax error for "root = Tk()" dlwaddel 15 10,782 Jan-29-2024, 12:07 AM
Last Post: dlwaddel
Photo SYNTAX ERROR Yannko 3 2,070 Jan-19-2024, 01:20 PM
Last Post: rob101
  Syntax error while executing the Python code in Linux DivAsh 8 8,731 Jul-19-2023, 06:27 PM
Last Post: Lahearle
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 11,603 Jun-27-2023, 01:17 PM
Last Post: diver999
  Code is returning the incorrect values. syntax error 007sonic 6 4,269 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  syntax error question - string mgallotti 5 3,667 Feb-03-2023, 05:10 PM
Last Post: mgallotti
  Syntax error? I don't see it KenHorse 4 3,846 Jan-15-2023, 07:49 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020