我无法在Ubuntu上同时安装golang和godoc。

huangapple go评论57阅读模式
英文:

I can't install golang and godoc at the same time on Ubuntu

问题

我使用sudo apt-get install golang安装了Golang。然后我可以使用go命令。但是没有godoc命令。我在网上找到了解决方法,可以使用sudo apt-get install golang-go.tools来安装godoc。当我这样做时,我可以使用godoc命令,但是go命令不再起作用。我该如何同时让它们都正常工作?

英文:

I installed golang using sudo apt-get install golang. Then I can use the go command. But there is no godoc command. I found online I can use sudo apt-get install golang-go.tools to install godoc. When I do that I can use the godoc command but the go command doesn't work anymore. How can I make them both work on the same time?

答案1

得分: 1

好的,我会为你翻译以下内容:

首先,我的建议是尝试移除golang-go.tools包,并尝试使用go get golang.org/x/tools/godoc命令,看看是否有效。

除此之外,提供更多详细信息会有所帮助。你在运行go命令时遇到了哪些错误?

英文:

Well, my first suggestion is to try removing the golang-go.tools package, and try go get golang.org/x/tools/godoc; see if that works.

Beyond that, adding more details would help. What error(s) are you getting when you try to run the go command now?

答案2

得分: 0

不要使用apt-get安装golang

首先卸载golang:

apt-get purge golang*

从https://golang.org/dl/下载编译好的go存档文件:

wget https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
tar -xvf go1.6.linux-amd64.tar.gz
mv go /usr/local

您可能需要设置Go路径。然后可以测试您的安装。

export PATH=$PATH:/usr/local/go/bin
go version

现在应该可以使用godoc了。

英文:

Don't install golang by apt-get.

First uninstall golang

apt-get purge golang*

Download compiled go archive from https://golang.org/dl/

wget https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
tar -xvf go1.6.linux-amd64.tar.gz
mv go /usr/local

You may need to set Go Paths. Then you can test your install.

export PATH=$PATH:/usr/local/go/bin
go version

godoc should be usable now.

huangapple
  • 本文由 发表于 2016年4月9日 04:27:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/36508755.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定