首页 > 解决方案 > 运行 make -f hello.py 时出现错误。它说“ hello.py:1: *** 缺少分隔符。停止。”

问题描述

这是 makefile 和 hello.py 的代码。我正在阅读与我类似的问题,我相信这是某个选项卡的问题,但我无法找到它。任何帮助将不胜感激,谢谢!

命令行输出:

hello.py:1: *** missing separator.  Stop.
PYTHON = python3
VIEWER = less

.PHONY: clean run view other_run

run :   hello.py
        $(PYTHON) hello.py

other_run :     hello.py
        chmod u+x hello.py
        ./hello.py

view :  hello.py
        - $(VIEWER) hello.py
print("Hello, World!\n")

标签: pythonmakefile

解决方案


make -f hello.py将视为hello.py几乎Makefile可以肯定不是您想要的

       -f file, --file=file, --makefile=FILE
           Use file as a makefile.

你可能只想make hello.py


推荐阅读