我正在关注 go 文档并尝试运行 hello.go。我在 Windows 7 上并使用 msi 安装程序安装 go 1.1.2。我有文件“C:\Go\pkg\tool\windows_386\8g.exe”(参见下面的目录输出),但是当我执行“go.exe run hello.go”时,我得到文件不存在错误。
请帮忙。谢谢你。
C:\>go.exe run hello.go
go build command-line-arguments: exec: "C:\\Go\\pkg\\tool\\windows_386\\8g.exe":
file does not exist
C:\>go.exe version
go version go1.1.2 windows/386
C:\>go.exe run hello.go
go build command-line-arguments: exec: "C:\\Go\\pkg\\tool\\windows_386\\8g.exe":
file does not exist
C:\>dir C:\\Go\\pkg\\tool\\windows_386\\8g.exe
The specified path is invalid.
C:\>dir C:\Go\pkg\tool\\windows_386\\8g.exe
Volume in drive C is Local Disk
Volume Serial Number is C07E-54F5
Directory of C:\Go\pkg\tool\windows_386
08/13/2013 07:04 AM 1,831,416 8g.exe
1 File(s) 1,831,416 bytes
0 Dir(s) 11,407,892,480 bytes free
Run Code Online (Sandbox Code Playgroud)
从问题 6224开始,如果您在运行之前将环境变量PATHEXT仅设置为一个扩展名,则会发生此错误go.exe。
set PATHEXT=.BATgo run hello.go什么是预期的输出?
没有错误并且 hello world 程序运行你看到了什么呢?
go build command-line-arguments:
exec: "c:\\Go\\pkg\\tool\\windows_386\\8g.exe": file does not exist
Run Code Online (Sandbox Code Playgroud)
8g Windows 7 64位go版本 go1.1.2 windows/386
在我的计算机(W7 64 位)上,我有:
set pa
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Run Code Online (Sandbox Code Playgroud)
一切都运行良好。
LookPath用“”调用,并且以邪恶的方式设置的c:\Go\pkg\tool\windows_386\8g.exe事实让我们说,make失败了PATHEXTLookPath