来源: 【已解决】go语言用go get去安装第三方包出错:exec: “hg”: executable file not found in %PATH% – 在路上
【问题】
折腾:
期间,去用:
1
|
go get code.google.com/p/log4go |
结果出错:
1
2
3
|
E:\Dev_Root\go\src\EmulateLoginBaidu>go get code.google.com/p/log4go go: missing Mercurial command. See http://golang.org/s/gogetcmd package code.google.com/p/log4go: exec: "hg": executable file not found in %PATH% |
如图:
即:
exec: “hg”: executable file not found in %PATH% |
【解决过程】
1.很明显,是在windows的cmd中,找不到hg。
而对于hg,如果是cygwin等环境,那肯定没问题,但是此处是cmd,所以没法用hg。
2.参考:
也是让去安装hg。
3.所以就需要去另外在windows中安装hg:
4.安装完毕,就可以继续去试试了:
1
2
3
|
E:\Dev_Root\go\src\EmulateLoginBaidu>go get code.google.com/p/log4go E:\Dev_Root\go\src\EmulateLoginBaidu> |
结果就是:
没有消息,就是最好的消息
即:安装成功了,无任何错误信息。
5.那就去确认一下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
E:\Dev_Root\go\src\EmulateLoginBaidu>go get code.google.com/p/log4go E:\Dev_Root\go\src\EmulateLoginBaidu>ls EmulateLoginBaidu.go EmulateLoginBaidu.go.bak EmulateLoginBaidu.log EmulateLoginBaidu.log.bak E:\Dev_Root\go\src\EmulateLoginBaidu>ls ../../src EmulateLoginBaidu EmulateLoginBaidu_2013-09-18_office_tryHandleCookie.7z code.google.com common_func_test hello E:\Dev_Root\go\src\EmulateLoginBaidu>cd E:\Dev_Root\go\src\EmulateLoginBaidu E:\Dev_Root\go\src\EmulateLoginBaidu>ls EmulateLoginBaidu.go EmulateLoginBaidu.go.bak EmulateLoginBaidu.log EmulateLoginBaidu.log.bak E:\Dev_Root\go\src\EmulateLoginBaidu>cd .. E:\Dev_Root\go\src>ls EmulateLoginBaidu EmulateLoginBaidu_2013-09-18_office_tryHandleCookie.7z code.google.com common_func_test hello E:\Dev_Root\go\src>cd code.google.com E:\Dev_Root\go\src\code.google.com>ls p E:\Dev_Root\go\src\code.google.com>cd p E:\Dev_Root\go\src\code.google.com\p>ls log4go E:\Dev_Root\go\src\code.google.com\p>cd log4go E:\Dev_Root\go\src\code.google.com\p\log4go>ls LICENSE README config.go examples filelog.go log4go.go log4go_test.go pattlog.go socklog.go termlog.go wrapper.go E:\Dev_Root\go\src\code.google.com\p\log4go>ls -lha total 94K drwx------+ 1 Administrators None 0 Sep 20 17:05 . drwx------+ 1 Administrators None 0 Sep 20 17:04 .. drwx------+ 1 Administrators None 0 Sep 20 17:05 .hg -rwx------+ 1 Administrators None 248 Sep 20 17:05 .hgtags -rwx------+ 1 Administrators None 1.3K Sep 20 17:05 LICENSE -rwx------+ 1 Administrators None 274 Sep 20 17:05 README -rwx------+ 1 Administrators None 7.7K Sep 20 17:05 config.go drwx------+ 1 Administrators None 0 Sep 20 17:05 examples -rwx------+ 1 Administrators None 6.3K Sep 20 17:05 filelog.go -rwx------+ 1 Administrators None 14K Sep 20 17:05 log4go.go -rwx------+ 1 Administrators None 17K Sep 20 17:05 log4go_test.go -rwx------+ 1 Administrators None 3.1K Sep 20 17:05 pattlog.go -rwx------+ 1 Administrators None 1.1K Sep 20 17:05 socklog.go -rwx------+ 1 Administrators None 1.2K Sep 20 17:05 termlog.go -rwx------+ 1 Administrators None 8.3K Sep 20 17:05 wrapper.go E:\Dev_Root\go\src\code.google.com\p\log4go>cd ../../bin 系统找不到指定的路径。 E:\Dev_Root\go\src\code.google.com\p\log4go>cd .. E:\Dev_Root\go\src\code.google.com\p>cd ../ E:\Dev_Root\go\src\code.google.com>cd .. E:\Dev_Root\go\src>cd ../bin E:\Dev_Root\go\bin>ls E:\Dev_Root\go\bin>cd .. E:\Dev_Root\go>cd pkg E:\Dev_Root\go\pkg>ls windows_amd64 E:\Dev_Root\go\pkg>cd windows_amd64 E:\Dev_Root\go\pkg\windows_amd64>ls code.google.com E:\Dev_Root\go\pkg\windows_amd64>cd code.google.com E:\Dev_Root\go\pkg\windows_amd64\code.google.com>ls p E:\Dev_Root\go\pkg\windows_amd64\code.google.com>cd p E:\Dev_Root\go\pkg\windows_amd64\code.google.com\p>ls log4go.a E:\Dev_Root\go\pkg\windows_amd64\code.google.com\p>ls -lha total 448K drwx------+ 1 Administrators None 0 Sep 20 17:05 . drwx------+ 1 Administrators None 0 Sep 20 17:05 .. -rwx------+ 1 Administrators None 448K Sep 20 17:05 log4go.a E:\Dev_Root\go\pkg\windows_amd64\code.google.com\p> |
的确是在pkg下有log4go.a的
在src下,是有对应目录结构的:
【总结】
此处通过go get安装包,出现:
exec: “hg”: executable file not found in %PATH% |
的错误,
原因是:
windows下没有安装Mercurial的hg(类似于cvs,svn,git的版本管理工具)
解决办法是:
去hg官网主页下载和安装即可: