Files
the-way-to-go_ZH_CN/eBook/02.5.md
2020-11-24 01:46:48 +08:00

24 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2.5 在 Windows 上安装 Go
你可以在 [下载页面](http://golang.org/dl/) 页面下载到 Windows 系统下的一键安装包。
前期的 Windows 移植工作由 Hector Chu 完成,但目前的发行版已经由 Joe Poirier 全职维护。
在完成安装包的安装之后,你只需要配置 `$GOPATH` 这一个环境变量就可以开始使用 Go 语言进行开发了其它的环境变量安装包均会进行自动设置。在默认情况下Go 将会被安装在目录 `c:\go` 下,但如果你在安装过程中修改安装目录,则可能需要手动修改所有的环境变量的值。
如果你想要测试安装,则可以使用指令 `go run` 运行 [hello_world1.go](examples/chapter_2/hello_world1.go)。
如果发生错误 `fatal error: cant find import: fmt` 则说明你的环境变量没有配置正确。
如果你想要在 Windows 下使用 cgo (调用 C 语言写的代码),则需要安装 [MinGW](http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/),一般推荐安装 [TDM-GCC](http://tdm-gcc.tdragon.net/)。如果你使用的是 64 位操作系统,请务必安装 64 位版本的 MinGW。安装完成进行环境变量等相关配置即可使用。
**在 Windows 下运行在虚拟机里的 Linux 系统上安装 Go**
如果你想要在 Windows 下的虚拟机里的 Linux 系统上安装 Go你可以选择使用虚拟机软件 [VMware](http://www.vmware.com),下载 [VMware player](http://www.vmware.com/products/player/),搜索并下载一个你喜欢的 Linux 发行版镜像,然后安装到虚拟机里,安装 Go 的流程参考第 2.3 节中的内容。
## 链接
- [目录](directory.md)
- 上一节:[在 Mac OS X 上安装 Go](02.4.md)
- 下一节:[安装目录清单](02.6.md)