0
distance/ $ make distance
make: *** No rule to make target 'distance'.  Stop.
distance/ $ code distance.py
distance/ $ make distance
make: *** No rule to make target 'distance'.  Stop.
distance/ $ 

Trying to run a Python program ( have copied and pasted program in to disatnce.py)and have made the directory, distance, and file distance.py however getting the above error, this seems very basic , what am I missing ?

thanks anybody

1
  • Please disregard my recent question, all good , obvious now
    – Geoff
    Commented Aug 4, 2023 at 9:41

1 Answer 1

0

It appears as though you're trying to use make to run a Python program, which is typically unnecessary. The make command is a rule based automation tool often most often used for compiling and linking compiled programs and libraries ( such as C/C++) , not usually for just directly running scripts such as Python ones.

In your case, make is trying to find a rule in a Makefile to build the target distance, but it's not finding any, thus the error. This is likely because you don't have a Makefile, or it doesn't contain a rule for distance.

However, since your program is a Python script, you do not typically need to use 'make'. You can directly run your Python script from the terminal using the 'python' or 'python3' command followed by your script's name. Try this command instead:

python3 distance.py

This tells Python to interpret your distance.py script. If your script is set up correctly, it should then run as expected.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .