英文:
How to properly install GO with paths and all?
问题
我已经安装了GO,并设置了路径,但是当我运行一个文件时,出现了以下错误:
错误!exec: "sqlboiler": 在$PATH中找不到可执行文件
exec: "sqlboiler": 在$PATH中找不到可执行文件
exec: "sqlboiler": 在$PATH中找不到可执行文件
退出状态 3
出了什么问题?
英文:
I have installed GO, setup the paths but when i run a file i get this error:
error!! exec: "sqlboiler": executable file not found in $PATH
exec: "sqlboiler": executable file not found in $PATH
exec: "sqlboiler": executable file not found in $PATH
exit status 3
What is going wrong?
答案1
得分: 5
安装说明很好,https://go.dev/doc/install。然而,在我的Ubuntu 20.4的wsl2上,建议的二进制文件路径不够。只有go
和gofmt
被添加到*/usr/local/go/bin*。
我在.bashrc
中添加了以下内容,因为在我的系统上,go install将二进制文件放在这个位置。
export PATH="$HOME/go/bin:$PATH"
请注意,二进制文件的路径可能因系统而异,所以你需要相应地进行调整。
使用go install安装的任何二进制文件都将在此路径下对你的shell可用。
例如:
$ go install github.com/volatiletech/sqlboiler/v4@latest
$ go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@latest
$ whereis sqlboiler
sqlboiler: /home/blue/go/bin/sqlboiler
可能还需要在系统上安装一些数据库包。我不确定这一点了。例如,如果你使用Postgres,可以添加一些Postgres库。你需要看看是否可以正常工作。
apt-get install postgresql-client-common postgresql-client-12
英文:
The installation instructions are good, https://go.dev/doc/install. However, for me un Ubuntu 20.4 in wsl2, the suggested path for the binaries wasn't enough. Only go
and gofmt
are added to /usr/local/go/bin.
I did add the below to my .bashrc
, since go install puts the binaries in this location on my system.
export PATH="$HOME/go/bin:$PATH"
Note, that the path to the binaries may differ on your system, so you have to adjust it accordingly.
Any binary you install with go install that is added to this path will be available to your shell afterwards.
For example:
$ go install github.com/volatiletech/sqlboiler/v4@latest
$ go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@latest
$ whereis sqlboiler
sqlboiler: /home/blue/go/bin/sqlboiler
Potentially, you also need some database packages to your system. I am not sure on this any more. For example, you could add some Postgres libs if you are using Postgres. You have to see if it works without.
apt-get install postgresql-client-common postgresql-client-12
答案2
得分: 0
如何正确安装GO并设置路径?
- 使用安装程序(Windows)或存档(在Linux/Mac上提取到
/usr/local
)安装Go。 - 如果从存档安装,请手动将
go
二进制文件所在的目录路径(/usr/local/go
)添加到PATH
中。 - 将
GOPATH
设置为包含bin
、pkg
和src
子目录的目录路径。 - 将
${GOPATH}/bin
添加到PATH
中。
出了什么问题?
您运行的程序试图运行名为sqlboiler
的可执行文件,但在PATH
指定的任何目录中都找不到它。
英文:
> How to properly install GO with paths and all?
- Install Go with the installer (Windows) or archive (extract into
/usr/local
on Linux/Mac). - When installing from archive, manually add the directory path where the
go
binary is located (/usr/local/go
) toPATH
. - Set
GOPATH
to a directory path wherein to containbin
,pkg
andsrc
sub-directories. - Add
${GOPATH}/bin
toPATH
.
> What is going wrong?
The program you are running is trying to run the executable sqlboiler
, which cannot be found in any of the directories specified in PATH
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论