2026年5月13日 星期三

MSI 桌機安裝 Gemini CLI

本篇繼續為 MSI 桌機安裝 Gemini CLI, 作法參考 :


這台 MSI 桌機硬體配備如下 :

CPU : intel 12th gen core i5-12400F
DRAM : 48GB
SSD : 1TB M.2 ADATA LEGEND 710 (C) + 2TB SATA Acer RE100 (D)
GPU : NVIDIA GeForce RTC3060 (12GB VRAM)

對 AI 應用來說算是入門級. 


1. 安裝 Node 版本管理工具 nvm : 

安裝 Gemini CLI 需要 Node, 先用 scoop 安裝 Node 版本管理工具 nvm : 

PS C:\Users\USER> scoop install nvm   
Installing 'nvm' (1.2.2) [64bit] from 'main' bucket
nvm-noinstall.zip (6.0 MB) [==================================================================================] 100%
Checking hash of nvm-noinstall.zip ... ok.
Extracting nvm-noinstall.zip ... done.
Running pre_install script...done.
Linking ~\scoop\apps\nvm\current => ~\scoop\apps\nvm\1.2.2
Adding ~\scoop\apps\nvm\current to your path.
Adding ~\scoop\apps\nvm\current\nodejs\nodejs to your path.
Persisting nodejs
Persisting elevate.cmd
Persisting elevate.vbs
Persisting settings.txt
'nvm' (1.2.2) was installed successfully!
Notes
-----
You'll need to restart powershell/cmd to have it reload Environment Variables so nvm will work correctly

關於 scoop 參考 :


再用 nvm 安裝 Node :

PS C:\Users\USER> nvm install node   
26.1.0
Downloading node.js version 26.1.0 (64-bit)...
Extracting node and npm...
Complete
Installation complete.
If you want to use this version, type:

nvm use 26.1.0

用 nvm use 指令啟用指定的 Node 版本 : 

PS C:\Users\USER> nvm use node  
26.1.0
Now using node v26.1.0 (64-bit)


2. 安裝 Gemini CLI :

安裝 nvm 時會附帶安裝 npm 工具, 使用 npm 指令安裝 Gemini CLI :

PS C:\Users\USER> npm install -g @google/gemini-cli  

added 7 packages in 10s
npm notice
npm notice New minor version of npm available! 11.13.0 -> 11.14.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.14.1
npm notice To update run: npm install -g npm@11.14.1
npm notice

用 gemini 指令啟動 Gemini CLI, 按 Enter 選 1. Trust the folder :




按 Enter 預設選 1. Sign in with Google :




按 Enter 選 1. Yes :





按允許 :




接下來會開啟瀏覽器, 輸入 Google 帳密登入 :








看到 Succeed 表示登入成功, 可關掉 PS 視窗, 因為開始使用 Gemini CLI 時最好要先建立一個專案目錄, 然後用 uv 工具初始化一個 Python 專案, 然後才是輪到 Gemini CLI 上場. 


3. 安裝 uv 工具 :

最後安裝 Python 虛擬環境與套件管理工具 uv, 基本上我都會使用 uv 來建立任何 Python 專案, 用 Claude Code 或 Gemini CLI 開發軟體也會叫它們用 uv 去測試生成的軟體 :

PS C:\Users\USER> scoop install uv   
Installing 'uv' (0.11.13) [64bit] from 'main' bucket
uv-x86_64-pc-windows-msvc.zip (22.3 MB) [=====================================================================] 100%
Checking hash of uv-x86_64-pc-windows-msvc.zip ... ok.
Extracting uv-x86_64-pc-windows-msvc.zip ... done.
Linking ~\scoop\apps\uv\current => ~\scoop\apps\uv\0.11.13
Creating shim for 'uv'.
Creating shim for 'uvx'.
Creating shim for 'uvw'.
Making C:\Users\USER\scoop\shims\uvw.exe a GUI binary.
'uv' (0.11.13) was installed successfully!

關於 uv 工具用法參考 : 


沒有留言:

張貼留言