At a guess, you typed something intended for the Windows command line (Command Prompt window) at the Python prompt, but I don’t know the purpose of the & at the start.
The & at the start of the line in Powershell is the call operator. So & <path> <args> will run an external command. You wouldn’t normally need to use ‘&’ explicitly but sometimes it’s needed to resolve ambiguity, for example the explicit path means Powershell may interpret the path as a string instead of a command name.
For example on my Mac using an explicit path to Python the & is required if I put the path in quotes but without the quotes it works fine either way:
PS /Users/duncan.booth> "/Users/duncan.booth/.pyenv/shims/python" -c "print('hi')"
ParserError:
Line |
1 | "/Users/duncan.booth/.pyenv/shims/python" -c "print('hi')"
| ~~
| Unexpected token '-c' in expression or statement.
PS /Users/duncan.booth> & "/Users/duncan.booth/.pyenv/shims/python" -c "print('hi')"
hi
PS /Users/duncan.booth> /Users/duncan.booth/.pyenv/shims/python -c "print('hi')"
hi
PS /Users/duncan.booth>
In this case I doubt the & was actually needed but they somehow managed to send the line intended to invoke Python from powershell into Python itself as a command.