###### tags: `Thonny` # 安裝 Thonny 軟體 [TOC] 要使用 MicroPython 撰寫程式, 雖然有許多可以選擇的開發環境, 但最方便的就是 [Thonny](https://thonny.org/)。Thonny 輕薄短小, 不但可作為開發一般電腦 Python 程式的環境, 也針對各種微控制板設計了對應的功能, 因此我們選擇使用 Thonny。 ## 軟體安裝 ### 在 Windows 上安裝 Thonny 在 Windows 上只要下載安裝檔, 執行後依照安裝步驟即可。 1. 請至[官網首頁](https://thonny.org/)右上角點選下載連結: ![](https://i.imgur.com/nEPEdox.png) :::warning 最新 4.x 版本在燒錄韌體時似乎有問題, 如果你要燒錄 MicroPython 韌體, 請下載 [3.3.13 版](https://github.com/thonny/thonny/releases/tag/v3.3.13) ::: :::info 由於 Thonny 4.0.1 開始[改用 64 位元版本的 Python 3.10](https://github.com/thonny/thonny/releases), 因此無法在 32 位元以及 Windows 7 作業系統上執行, 在 Windows 7 會出現以下錯誤: ![](https://i.imgur.com/kvqoSkr.png) 請改成下載使用 32 位元 Python 3.8 的 [thonny-py38-4.0.1.exe](https://github.com/thonny/thonny/releases/download/v4.0.1/thonny-py38-4.0.1.exe)。 ::: 1. 下載後直接執行: :::info 若出現安全性畫面, 請按**仍要安裝**或是 **Install anyway**: ![](https://i.imgur.com/CwuqAmi.png) ::: ![](https://i.imgur.com/EPW8vj6.png) 按 **Next**。 1. 按 **I accecpt the agreement** 後按 **Next**: ![](https://i.imgur.com/CAAnA2x.png) 1. 確認安裝路徑後按 **Next**: ![](https://i.imgur.com/NzU3gb6.png) 1. 繼續按 **Next**: ![](https://i.imgur.com/D9F01sZ.png) 1. 請勾選 **Create desktop icon** 方便執行 Thonny: ![](https://i.imgur.com/8NAJwaC.png) 按 **Next** 繼續。 1. 確認無誤後按 **Install** 進行安裝: ![](https://i.imgur.com/hC1HuX1.png) 1. 安裝完成按 **Finish**: ![](https://i.imgur.com/BLiWrTz.png) 1. 可在桌面上找到執行 Thonny 的捷徑: ![](https://i.imgur.com/pHH9IEX.png) 或者利用搜尋方式找到 Thonny: ![](https://i.imgur.com/xENbFVQ.png) ### 在 Mac 上安裝 Thonny 在 Mac 只需要下載安裝檔案執行後依照步驟即可。 1. 請至[官網首頁](https://thonny.org/)右上角點選下載連結: ![](https://i.imgur.com/jvM19nr.png) 1. 下載後直接執行: ![](https://i.imgur.com/0KMNGMs.png) 按**繼續**。 1. 再按 **執行**: ![](https://i.imgur.com/i534bw1.png) 按 **同意**: ![](https://i.imgur.com/mrPRx4n.png) 1. 按 **安裝**: ![](https://i.imgur.com/PHnXBOn.png) 這裡會需要鍵入你的密碼, 請鍵入後即可繼續安裝。 1. 安裝完成按 **關閉**: ![](https://i.imgur.com/zJHZOrs.png) 1. 接著就可以在**啟動器**中找到 Thonny。 ### 在 Linux 上安裝 Thonny 在 Linux 上雖然可以使用套件管理系統安裝打包好的 Thonny, 不過版本比較舊, 請依照以下步驟安裝新版的 Thonny: 1. 在 Thonny 官網首頁右上方按一下 **Linux** 字樣可以顯示 Linux 安裝的指示: ![](https://i.imgur.com/nNfPrYZ.png) 2. 複製 "Binary bundle for PC" 項目的指令。 4. 開啟終端機, 在終端機中貼上複製的指令執行即可: ``` $ bash <(wget -O - https://thonny.org/installer-for-linux) 正重新導向輸出至「「wget-log.1」」。 This script will download and install Thonny (thonny-3.3.13) for Linux (32 or 64-bit PC). Press ENTER to continue or Ctrl+C to cancel. ... nstallation was successful, you can start Thonny from start menu under Education or Programming, or by calling /home/meebox/apps/thonny/bin/thonny For uninstalling Thonny call /home/meebox/apps/thonny/bin/uninstall Press ENTER to exit the installer. ``` 1. 將使用者加入 dialout 群組: ``` $ sudo usermod -a -G dialout <這裡要改成你的使用者名稱> [sudo] <你的的密碼>: ``` 執行後會需要你的密碼, 填入後按下 <kbd>enter</kbd> 即可。 1. 登出後重新登入, 加入群組的設定才會生效。 :::warning 若是沒有加入 dialout 群組, 在連線到控制板時會出現以下錯誤: ![](https://i.imgur.com/z40DsP9.png) 錯誤訊息中就會提示你將自己加入到 dialout 群組, 這是因為要使用 USB 與外部裝置傳輸資料需要特定的權限, 只要加入 dialout 群組就可以擁有所需的權限 ::: 1. 接著就可以在主畫面搜尋找到 Thonny 應用程式: ![](https://i.imgur.com/BjMl0HJ.png) ## 執行 Thonny 請依照個別平台找到 Thonny 執行捷徑, 然後依照下列步驟執行: 1. 請選取**繁體中文-TW** 語系後按 **Let's go!**: ![](https://i.imgur.com/MWZHvvm.png) 1. 即可看到 Thonny 主畫面: ![](https://i.imgur.com/Grs24hP.png) ## 設定 Thonny 環境 如果覺得畫面上字太小, 可以如下調整: 1. 執行『**工具/選項**』功能表指令開啟**選項**視窗, 切換到**主題與自行**頁次: ![](https://i.imgur.com/8ZREfCL.png) 右上方即可選取適當的字級大小。 2. 也可選取不同的主題配色, 後續都以如下配色展示: ![](https://i.imgur.com/F5z4oM6.png) 3. 如果覺得功能表下的工具列圖示太小: ![](https://i.imgur.com/cG1IYVH.png) 也可以在**選項**交談窗中切換到**一般**頁次, 調整**使用介面的縮放倍數**, 但要注意的是**這個設定必須重新開 Thonny 才會生效**。 1. 按**確認**關閉交談窗。