Golang – 如何运行引用了一个包的命令

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

Golang - how to run a command referring to a package

问题

我是你的中文翻译助手,以下是翻译好的内容:

我是Golang的新手,正在尝试运行以下包中的命令:

https://github.com/ryanbressler/CloudForest

该包的快速入门部分提供了以下命令:

growforest -train train.fm -rfpred forest.sf -target B:FeatureName

但我不确定如何使用该命令。

我已经在我的D盘上克隆了该包,并尝试在Ms-dos窗口中运行它,但出现了错误:

d:\DATA-SCIENCE\Go>go run growforest -train train.fm -rfpred forest.sf -target B:FeatureName
go run: no go files listed

我还尝试在go文件中运行该命令,但也不起作用:

package main

import (
	"github.com/ryanbressler/CloudForest"
)

func main() {
	growforest -train train.fm -rfpred forest.sf -target B:FeatureName
}

有人可以帮助我理解应该如何使用吗?

英文:

I am new to Golang, and trying to run a command from the following package:

https://github.com/ryanbressler/CloudForest

The command proposed in the Quick Start section of the package is:

growforest -train train.fm -rfpred forest.sf -target B:FeatureName

but I am not sure how to use the command.

I have cloned the package on my D drive, and tried running it in Ms-dos window and get an error:

d:\DATA-SCIENCE\Go>go run growforest -train train.fm -rfpred forest.sf -target B:FeatureName
go run: no go files listed

I also tried running the command inside a go file, but that doesn't work either:

package main

import (
	"github.com/ryanbressler/CloudForest"
)

func main() {
	growforest -train train.fm -rfpred forest.sf -target B:FeatureName
}

Can anyone help me understand how this is supposed to be used?

答案1

得分: 3

你需要先安装该软件包。

go install

然后,growforest 命令将会在你的 GOPATH\bin 目录下可用(该目录应该已经添加到你的 PATH 环境变量中)。

理想情况下,你应该执行 go get github.com/ryanbressler/CloudForest,这将会克隆、构建和安装该仓库到 GOPATH/src/github.com/ryanbressler/CloudForest 目录下。请参考"下载和安装软件包及其依赖项"。

根据 README 文件的说明,你需要安装项目的特定部分:

go get github.com/ryanbressler/CloudForest
go install github.com/ryanbressler/CloudForest/growforest
go install github.com/ryanbressler/CloudForest/applyforest

# 可选的工具
go install github.com/ryanbressler/CloudForest/leafcount
go install github.com/ryanbressler/CloudForest/utils/nfold
go install github.com/ryanbressler/CloudForest/utils/toafm
英文:

You need to install the package first

go install

Then the growforest command will be available in your GOPATH\bin (which should be part of your PATH environment variable)

Ideally, you should do a go get github.com/ryanbressler/CloudForest, which will clone and build and install the repo in GOPATH/src/github.com/ryanbressler/CloudForest.
See "Download and install packages and dependencies".

From the README, you need to install specific parts of the project:

go get github.com/ryanbressler/CloudForest
go install github.com/ryanbressler/CloudForest/growforest
go install github.com/ryanbressler/CloudForest/applyforest

#optional utilities
go install github.com/ryanbressler/CloudForest/leafcount
go install github.com/ryanbressler/CloudForest/utils/nfold
go install github.com/ryanbressler/CloudForest/utils/toafm

huangapple
  • 本文由 发表于 2014年8月11日 16:39:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/25239035.html
匿名

发表评论

匿名网友

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

确定