Error while compiling ESP8266 D1 R1

Hello everyone! I am using WeMos D1 R1 for my project. I copied an example, and I was trying to verify and upload it. I get the error message saying "Error compiling for Board WeMos D1 R1.

Arduino: 1.8.12 (Mac OS X), Board: "WeMos D1 R1, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

fork/exec /Users/sarthpatel/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3: no such file or directory
Error compiling for board WeMos D1 R1.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

"I copied an example"

Can you post the example using </> code tags?

Yes sure.

<void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is active low on the ESP-01)
delay(1000); // Wait for a second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
}
/>

I copied your code (below), and it compiles and runs on my WeMOS D1 development board, blinking the LED. Note that I'm using IDE 1.8.10 on a windows 10 machine.

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
  // but actually the LED is on; this is because
  // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}

I have a macOS, and it does not work on mine. Does it only work on windows?

The problem is the ESP8266 platform has a tool dependency on Python 3, but rather than installing a dedicated copy of Python 3 with the package, the ESP8266 platform developers assume you have Python 3 already installed at /usr/local/bin/python3.

The python3 file at the path shown in the error message is just a symlink to that location. So either you have Python 3 installed somewhere else, like /usr/bin/python3, or maybe you don't have Python 3 installed at all. If the former, you need to modify the symlink, as described here. If the latter, you need to install Python (and possibly modify the symlink as well if it was installed to a location other than /usr/local/bin/python3.

More information:

If you are using an esp8266 have you installed the boards onto your arduino IDE?