GitHub 上提供的在 Arduino IDE 中安装 ESP32 环境的方法,我翻成中文希望能帮助到一些洋文不太好的小伙伴哈哈哈
原文小学生英语,我这翻译也没啥用,只是希望我遇到的几个问题可以提供参考
原文
Installation instructions for Mac OS
-
Install latest Arduino IDE from arduino.cc
-
Open Terminal and execute the following command (copy->paste and hit enter):
mkdir -p ~/Documents/Arduino/hardware/espressif && \
cd ~/Documents/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 --depth 1 && \
cd esp32 && \
git submodule update --init --recursive --depth 1 && \
cd tools && \
python get.py
Where ~/Documents/Arduino
represents your sketch book location as per “Arduino” > “Preferences” > “Sketchbook location” (in the IDE once started). Adjust the command above accordingly if necessary!
- If you get the error below. Install the command line dev tools with xcode-select --install and try the command above again:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcode-select --install
-
Try
python3
instead ofpython
if you get the error:IOError: [Errno socket error] [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)
when runningpython get.py
-
If you get the following error when running
python get.py
urllib.error.URLError: <urlopen error SSL: CERTIFICATE_VERIFY_FAILED, go to Macintosh HD > Applications > Python3.6 folder (or any other python version), and run the following scripts: Install Certificates.command and Update Shell Profile.command -
Restart Arduino IDE
翻译
- 从 Arduino.cc 安装最新版本的 Arduino IDE
译者注:这里建议从 Arduino 中文社区下载
- 打开终端运行下面的代码(复制,粘贴,然后按下回车键)
mkdir -p ~/Documents/Arduino/hardware/espressif && \
cd ~/Documents/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 --depth 1 && \
cd esp32 && \
git submodule update --init --recursive --depth 1 && \
cd tools && \
python get.py
~/Documents/Arduino
的位置是根据“Arduino”>“偏好设置(cmd
+,
)”>“项目文件夹位置”。有必要的话调整上面的命令
译者注:例如,我是在 /Documents 文件夹下新建了 /学习资料/嵌入式/Arduino,项目文件保存于此,所以我上方的代码改为了:
mkdir -p ~/Documents/学习资料/嵌入式/Arduino/hardware/espressif && \
cd ~/Documents/学习资料/嵌入式/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 --depth 1 && \
cd esp32 && \
git submodule update --init --recursive --depth 1 && \
cd tools && \
python3 get.py #这里因为 Python版本做的改动,后文会解释
- 如果你显示了这样的错误:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
在终端中运行下面的命令来安装命令行开发工具
xcode-select --install
安装好后重新运行第二步的代码(即mkdir -p ~/Do。。。)
- 如果你在运行
python get.py
时显示了这样的错误
IOError: [Errno socket error] [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)
把python
换成python3
- 如果你在运行
python get.py
时显示了这样的错误
urllib.error.URLError: <urlopen error SSL: CERTIFICATE_VERIFY_FAILED
前往 Macintosh HD > Applications > Python3.6 文件夹(或其他 python 版本),运行「Install Certificates.command」和「Update Shell Profile.command」
译者注:让我看看有没有憨批和我一样在终端运行这行代码:
Install Certificates.command and Update Shell Profile.command
如果你是和我一样的憨憨,你会得到这个界面哈哈哈
其他问题
如果你在过程中遇到了其他的问题,可以看一下这篇博客