golang 遇到go get下载golang.org/x/net/context失败问题(windows解决方案)
2014 年 6 月 21 日
错误信息: package golang.org/x/net/context: unrecognized import path “golang.org/x/net/context”
类似错误信息:
package golang.org/x/net/context: unrecognized import path “golang.org/x/net/context” (https fetch: Get https://golang.org/x/net/context?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
windows解决方案:
windows解决方案:
1.打开PowerShell(本人是win10系统,和CMD打开程序一样,输入PowerShell搜索PowerShell,然后打开)
2.在PowerShell中输入如下两个命令
$env:GOPROXY = “https://goproxy.io”
$env:GO111MODULE=”on”
3.开始在PowerShell中go get项目,执行下面命令:
go get github.com/项目
4.此时我遇到问题:
exec: “gcc”: executable file not found in %PATH%
解决exec: “gcc”: executable file not found in %PATH%问题:
解决exec: “gcc”: executable file not found in %PATH%问题:
1.下载MinGW
MinGW分为较早开发的MinGW32和之后为编译64位程序开发的MinGW-w64,MinGW32只能编译32位的程序,而mingw64不仅能编译64位程序,也能编译32位程序,还能进行交叉编译,即在32位主机上编译64位程序,在64位主机上编译32位程序。
由于用的window10 企业版64位操作系统,要下载mingw 64位(官网地址: http://mingw-w64.org/doku.php ),下载地址: https://sourceforge.net/projects/mingw-w64/