Go: “no such file or directory” 但它存在

标签 go

我安装了 golang。

~/go/bin$ ls
go  godoc  gofmt

尝试测试,但无济于事。

~/go/bin$ go version
-bash: /home/orc/go/bin/go: no such file or directory

我的 $PATH:

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/orc/go/bin:

信息:

~/go/bin$ uname -m
x86_64

~/go/bin$ file go
go: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

~/go/bin$ pwd
/home/orc/go/bin

请告诉我哪里出了问题?

更新

~/go/bin$ ls -l
итого 28688
-rwxr-xr-x 1 orc orc 9571864 Фев 18 14:40 go
-rwxr-xr-x 1 orc orc 16164032 Фев 18 14:41 godoc
-rwxr-xr-x 1 orc orc 3594712 Фев 18 14:40 gofmt

~/go/bin$ ./go
-bash: ./go: Нет такого файла или каталога

!!!

~/go/bin$ file $(which ls)
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

~/go/bin$ uname -a
Linux olimp-web 2.6.32-5-amd64 #1 SMP Mon Jun 13 05:49:32 UTC 2011 x86_64 GNU/Linux

请解释如何修复它?

最佳答案

您是否检查过是否安装了适用于您的体系结构的正确版本。当我将 32 位二进制文​​件放在 64 位虚拟机上时,我刚刚遇到了这个确切的问题。我删除了 32 位版本并安装了适合体系结构的版本(根据网站上的说明)并且它有效。希望这对你也有用。

关于Go: “no such file or directory” 但它存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29337865/

相关文章:

design-patterns - Golang 自动包含可扩展应用程序

string - 修复了 byte slice 到字符串的转换——忽略空值

go - 在 Golang : how to rewrite return value's type 中为现有类型添加方法

git - 在每次提交时分别运行 go fmt 时,是否有任何工具会重新设置 Git 中的分支?

go - 为什么错误类型上的类型开关不起作用?

mongodb - 结构/结果的倒序时间顺序

datetime - 解析奇怪的日期格式

php - 仅带有脚本标签的 HTML 文件

reflection - 戈朗 : Function to determine the arity of functions?

mysql - 在golang中如何支持多种sql语法(mysql vs postgres)