這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
筆者最近需要研究Ethereum, 調研了一下,選擇編譯Go-Ethereum
在windows下,安裝了Go package在 C:\GO。 環境變數裡設了環境變數GOROOT=C:\GO
另外設定Go的工作目錄(我用了C:\GOWORK),環境變數裡設了環境變數GOPATH=C:\GOWORK。
首先,安裝Chocolatey。
以管理員身份啟動PowerShell prompt視窗,執行
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
然後運行
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
安裝完chocolatey後,第二步安裝Go-Ehtereum環境: git, golang, mingw. 由於我已經安裝了git和golang。我只運行下面的命令
choco install mingw
第三步,配置編譯環境
開啟一個新的命令視窗,運行以下命令:
set "GOPATH=C:\GOWORK"
set "Path=C:\GOWORK\bin;%Path%"
setx GOPATH "%GOPATH%"
setx Path "%Path%"
mkdir src\github.com\ethereum
git clone https://github.com/ethereum/go-ethereum src\github.com\ethereum\go-ethereum
cd src\github.com\ethereum\go-ethereum
go get -u -v golang.org/x/net/context
最後編譯, 在C:\GOWORK\src\github.com\ethereum\go-ethereum目錄下,運行
go install -v ./...
Hola, Exe 檔案產生:
編譯中遇到的問題:
筆者二維碼
註: 原創,轉載請註明出處