Golang - 如何运行引用包的命令

时间:2014-08-11 08:39:09

标签: go

我是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
}

任何人都可以帮我理解这应该如何使用吗?

1 个答案:

答案 0 :(得分:3)

您需要先安装软件包

go install

然后growforest命令将在GOPATH\bin中可用(应该是PATH环境变量的一部分)

理想情况下,您应该执行go get github.com/ryanbressler/CloudForest,它将在GOPATH/src/github.com/ryanbressler/CloudForest中克隆并构建和安装存储库。
请参阅“Download and install packages and dependencies”。

在README中,您需要安装项目的特定部分:

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