昨天我使用 MacOS Arduino IDE 或 VS Code 编译 Arduino 草图没有问题。
但是今天什么也编译不了。我尝试在 Arduino IDE 或带有 Arduino 扩展的 VS Code 中编译的任何草图都会出现此错误:
fork/exec /Library/Frameworks/Python.framework/Versions/3.11/bin/python3: exec format error
Compilation error: fork/exec /Library/Frameworks/Python.framework/Versions/3.11/bin/python3: exec format error
在我看来,这像是一个 Python 问题,但我不知道如何诊断它。
我添加了以下内容,以防有帮助:
当我运行:“~which python3”时,我得到:
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3
当我运行:“~ python --version”时,我得到:
Python 3.10.6
...我能想到的唯一可能改变事情的是我运行了 MacOS“Docker”应用程序来检查它并在打开后立即退出。这会对我的 Python 安装造成影响吗?
非常感谢任何帮助。谢谢...
编译错误:
Creating esp32 image...
Merged 27 ELF sections
Successfully created esp32 image.
Multiple libraries were found for "PubSubClient.h"
Used: /Users/(username)/Documents/Arduino/libraries/PubSubClient
Not used: /Users/(username)/Documents/Arduino/libraries/TBPubSubClient
Multiple libraries were found for "WiFi.h"
Used: /Users/(username)/Library/Arduino15/packages/esp32/hardware/esp32/2.0.17/libraries/WiFi
Not used: /Users/(username)/Documents/Arduino/libraries/WiFiNINA
python3 /Users/(username)/Library/Arduino15/packages/esp32/hardware/esp32/2.0.17/tools/gen_esp32part.py -q /private/var/folders/7f/4qj_xs8117z4jzt1k609bcc40000gp/T/arduino/sketches/E3FEF3521140621E6A9B6D076EFE409D/partitions.csv /private/var/folders/7f/4qj_xs8117z4jzt1k609bcc40000gp/T/arduino/sketches/E3FEF3521140621E6A9B6D076EFE409D/Async_OTA_DRD_MQTT_1.ino.partitions.bin
Using library AsyncElegantOTA at version 2.2.8 in folder: /Users/(username)/Documents/Arduino/libraries/AsyncElegantOTA
Using library WiFi at version 2.0.0 in folder: /Users/(username)/Library/Arduino15/packages/esp32/hardware/esp32/2.0.17/libraries/WiFi
Using library AsyncTCP at version 1.1.4 in folder: /Users/(username)/Documents/Arduino/libraries/AsyncTCP
Using library Update at version 2.0.0 in folder: /Users/(username)/Library/Arduino15/packages/esp32/hardware/esp32/2.0.17/libraries/Update
Using library ESP Async WebServer at version 3.0.6 in folder: /Users/(username)/Documents/Arduino/libraries/ESP_Async_WebServer
Using library FS at version 2.0.0 in folder: /Users/(username)/Library/Arduino15/packages/esp32/hardware/esp32/2.0.17/libraries/FS
Using library PubSubClient at version 2.8 in folder: /Users/(username)/Documents/Arduino/libraries/PubSubClient
Using library ESPAsync_WiFiManager at version 1.15.1 in folder: /Users/(username)/Documents/Arduino/libraries/ESPAsync_WiFiManager
Using library ESP AsyncDNSServer at version 1.0.0 in folder: /Users/(username)/Documents/Arduino/libraries/ESPAsyncDNSServer
Using library ESP32 Async UDP at version 2.0.0 in folder: /Users/(username)/Library/Arduino15/packages/esp32/hardware/esp32/2.0.17/libraries/AsyncUDP
fork/exec /Library/Frameworks/Python.framework/Versions/3.11/bin/python3: exec format error
Compilation error: fork/exec /Library/Frameworks/Python.framework/Versions/3.11/bin/python3: exec format error
又是我,OP。
从未得到这个问题的答案,因此彻底卸载了所有Python安装(MacOS系统版本除外,MacOS需要该版本)。
由于某种原因,这并没有做到这一点,所以手动删除了所有剩余的Python目录(Python2和Python3)、框架、我能找到的任何东西,然后使用“brew doctor”和“brew cleanup”来指出损坏的链接和其他事宜。这解决了这个问题,尽管其他一些需要 python 的应用程序现在也有问题。这些问题都通过重新安装 Python(“brew install python3”)解决。现在看来一切都很好。
我完全承认我不知道自己在做什么,但没有直接指导,也没有通过谷歌搜索找到明显的解决方案,幸运的是它有效。只是运气好,我知道,情况可能会更糟......;)