英文:
Can't install Revel (Unrecognized import path)
问题
我是一个Go语言的初学者,我想使用Revel web框架。
我已经安装了Git、Mercurial,甚至还有Bazaar和CVS。
我检查了我的环境变量。我将环境变量GOPATH设置为D:\Go,并将D:\Go\bin添加到了PATH中。但是当我运行go get The Revel Framework(go get github.com/revel/revel)时,我仍然遇到以下错误:
- 包golang.org/x/net/websocket:无法识别的导入路径"golang.org/x/net/websocket"
- 包gopkg.in/fsnotify.v1:无法识别的导入路径"gopkg.in/fsnotify.v1"
英文:
I'm a beginner in Go and I would like to use the Revel web framework.
I installed: Git; Mercurial and even: Bazaar and CVS.
I checked my environment variables. I set environment variable GOPATH to D:\Go and added D:\Go\bin to PATH.But I still get these errors when I go get The Revel Framework (go get github.com/revel/revel)
**
-
package golang.org/x/net/websocket: unrecognized import path "golang.org/x/net/websocket"
-
package gopkg.in/fsnotify.v1: unrecognized import path "gopkg.in/fsnotify.v1"**
答案1
得分: 2
安装GO到您的主文件夹中,您需要设置以下环境变量:
.
├── bin
├── go (GO)
└── src
├── revel.project
│ ├── app
│ │ ├── controllers
│ │ ├── models
│ │ ├── routes
│ │ ├── tmp
│ │ └── views
│ │ ├── admin
│ │ ├── App
│ │ ├── errors
│ │ └── users
│ ├── conf
│ ├── messages
│ ├── public
│ │ ├── css
│ │ │ └── administrator
│ │ ├── img
│ │ ├── js
│ │ └── uploads
│ │ └── 1
│ ├── resources
│ ├── scripts
│ ├── test-results
│ └── tests
├── code.google.com
├── github.com
│ ├── revel
│ │ ├── cmd
│ │ ├── modules
│ │ └── revel
在命令提示符路径中运行以下命令,或根据您的文件夹进行修改:
export GOARCH=amd64
export GOPATH=~/go
export GOBIN=~/go/go/bin
export GOROOT=~/go/go
export PATH=$PATH:$GOPATH/go/bin
export GOTOOLDIR=~/go/go/pkg/tool/linux_amd64
export CC="gcc"
export GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
export CXX=g++
export CGO_ENABLED=1
其中,~是您系统中个人文件夹的名称(Bash Gnu Linux)。
英文:
For instalation of GO into your home folder you need this environment variables:
.
├── bin
├── go (GO)
└── src
├── revel.project
│   ├── app
│   │   ├── controllers
│   │   ├── models
│   │   ├── routes
│   │   ├── tmp
│   │   └── views
│   │   ├── admin
│   │   ├── App
│   │   ├── errors
│   │   └── users
│   ├── conf
│   ├── messages
│   ├── public
│   │   ├── css
│   │   │   └── administrator
│   │   ├── img
│   │   ├── js
│   │   └── uploads
│   │   └── 1
│   ├── resources
│   ├── scripts
│   ├── test-results
│   └── tests
├── code.google.com
├── github.com
│   ├── revel
│   │   ├── cmd
│   │   ├── modules
│   │   └── revel
run this in your prompt path or modify if your folders are differents.
export GOARCH=amd64
export GOPATH=~/go
export GOBIN=~/go/go/bin
export GOROOT=~/go/go
export PATH=$PATH:$GOPATH/go/bin
export GOTOOLDIR=~/go/go/pkg/tool/linux_amd64
export CC="gcc"
export GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
export CXX=g++
export CGO_ENABLED=1
Where ~ is the name of you personal folder in the system (Bash Gnu Linux)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论