Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 为什么会';go build file.go';在本地终端可以正常工作,但在SSH上给我一个错误?_Linux_Bash_Ssh_Go - Fatal编程技术网

Linux 为什么会';go build file.go';在本地终端可以正常工作,但在SSH上给我一个错误?

Linux 为什么会';go build file.go';在本地终端可以正常工作,但在SSH上给我一个错误?,linux,bash,ssh,go,Linux,Bash,Ssh,Go,当我在本地终端(ubuntu上的Konsole)上运行“go build file.go”(或“go install”)时,我的代码正确构建,没有任何警告。但是,当我使用SSH(从另一个linux设备或从Windows使用PuTTY)进入完全相同的机器时,我会收到警告消息: 警告:设置为GOROOT(/home/[username]/go)的GOPATH对go无效 构建运行时:必须使用make.bash引导linux/amd64 在终端中: “go版本”报告go1.3.3 linux/amd64

当我在本地终端(ubuntu上的Konsole)上运行“go build file.go”(或“go install”)时,我的代码正确构建,没有任何警告。但是,当我使用SSH(从另一个linux设备或从Windows使用PuTTY)进入完全相同的机器时,我会收到警告消息:

警告:设置为GOROOT(/home/[username]/go)的GOPATH对go无效 构建运行时:必须使用make.bash引导linux/amd64

在终端中:
“go版本”报告go1.3.3 linux/amd64
“哪个go”报告/usr/local/go/bin/go
通过SSH:
“go版本”报告go1.2.1 linux/amd64

“which go”报告/home/[username]/go/bin/go

显然,本地(大概是GUI桌面)Ubuntu登录和ssh登录的环境不同

这并不意外

建议:

1) 从本地Konsole GUI终端键入“env”。记下对您特别重要的环境变量:PATH、GOPATH、GOROOT等

2) 编辑您的
$HOME/.profile
文件(也称
~/.profile

显式设置这些变量

3) 再次尝试ssh-查看是否有任何差异

另见:

您也可以考虑启用远程VNC:


您在哪里设置围棋环境变量<代码>.bashrc
.bash\u登录
<代码>配置文件?桌面环境启动?修复:我通常使用.bashrc作为环境变量,但出于某种原因,我修改了.bash_配置文件以更改go的路径。