在 Visual Studio Code 使用 Google Colab
在 Visual Studio Code 使用 Google Colab 有兩種主要方式:
Google 在 2025 年正式釋出 Colab VS Code Extension:
!pip install colabcode
from colabcode import ColabCode
ColabCode(port=10000, password="yourpassword")
`
!pip install colab_ssh --upgrade
from colabssh import launchssh_cloudflared
launchsshcloudflared(password="yourpassword")
`
- 取得 SSH 連線資訊後,在 VS Code 使用 Remote-SSH 插件連線。
- 這樣就能把 Colab 當作遠端主機,在 VS Code 本地編輯並執行。
👉 適合需要完整 VS Code 桌面體驗,並且熟悉 SSH/遠端開發的使用者。
---
## 📌 總結
- 最簡單方式:安裝 Google 官方 Colab VS Code 插件,直接在 VS Code 中選擇 Colab Kernel。
- 進階方式:用 colabcode 或 colab_ssh,把 Colab 當作遠端伺服器,透過 VS Code Remote 連線。
- 注意:Colab 的免費資源有使用限制(例如 GPU 使用時間),在 VS Code 中使用時也會受到相同規範。
# Also See
```dataview
table file.name as "File", date(file.mtime) as "Last Modified"
from ""
where file.path != this.file.path and file.folder = this.file.folder and file.path != null
sort file.mtime desc