登录
首页 >  Golang >  Go问答

如何在 Mac 上设置 Go 的 Wails 路径?

来源:stackoverflow

时间:2024-04-11 18:30:27 278浏览 收藏

Golang不知道大家是否熟悉?今天我将给大家介绍《如何在 Mac 上设置 Go 的 Wails 路径?》,这篇文章主要会讲到等等知识点,如果你在看完本篇文章后,有更好的建议或者发现哪里有问题,希望大家都能积极评论指出,谢谢!希望我们能一起加油进步!

问题内容

我尝试在 Mac 上将 Wails 与 Go 结合使用,但在设置正确路径时遇到问题。我已经安装了 Wails 和 Go,但是当我尝试使用 wails build 构建我的 Wails 应用程序时,我收到一条错误消息:“在路径上找不到 Go。”

如何为 Go 设置正确的路径以便 Wails 可以找到它?任何帮助将不胜感激。谢谢!


正确答案


要设置,请遵循以下准则:

devn@macbook-pro-2 ~ % wails doctor
zsh: command not found: wails
devn@macbook-pro-2 ~ % mkdir ~/go
mkdir: /Users/devn/go: File exists
devn@macbook-pro-2 ~ % export GOPATH=~/go 
devn@macbook-pro-2 ~ % go install github.com/wailsapp/wails/v2/cmd/wails@latest

devn@macbook-pro-2 ~ % export PATH=$PATH:$(go env GOPATH)/bin

devn@macbook-pro-2 ~ % ~/.bashrc
zsh: permission denied: /Users/devn/.bashrc
devn@macbook-pro-2 ~ % sudo ~/.bashrc
Password:
sudo: /Users/devn/.bashrc: command not found
devn@macbook-pro-2 ~ % sudo ~/.bash_profile
sudo: /Users/devn/.bash_profile: command not found
devn@macbook-pro-2 ~ % source ~/.bashrc
devn@macbook-pro-2 ~ % wails version
v2.4.1
 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
devn@macbook-pro-2 ~ %

本篇关于《如何在 Mac 上设置 Go 的 Wails 路径?》的介绍就到此结束啦,但是学无止境,想要了解学习更多关于Golang的相关知识,请关注golang学习网公众号!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>