错误消息说我的目录有语法错误

Error message saying my directory has a syntax error

我向我的 pygame 项目添加了一些代码,然后我尝试 运行 它。我收到这个错误。

>>> & C:/Users/shado/AppData/Local/Programs/Python/Python37/python.exe "c:/Users/shado/coding - PYTHON/schoolgame/MyNewGame.py"
  File "<stdin>", line 1
    & C:/Users/shado/AppData/Local/Programs/Python/Python37/python.exe "c:/Users/shado/coding - PYTHON/schoolgame/MyNewGame.py"
    ^
SyntaxError: invalid syntax

我CTRL + Z'd我写的代码,但问题仍然存在。顺便说一句,胡萝卜指向错误消息中的符号。

这很可能是因为您是运行 Python Shell中的命令。尝试 运行 这个命令:

quit()

然后 运行 之前的命令:

& C:/Users/shado/AppData/Local/Programs/Python/Python37/python.exe "c:/Users/shado/coding - PYTHON/schoolgame/MyNewGame.py"