gocv
gocv copied to clipboard
installing with "go get" gives "go.mod file not found in current directory or any parent directory."
Description
Coming from Python, I'm just starting out with go, so please forgive me my ignorance. I'm trying to install gocv using the instructions here: https://gocv.io/getting-started/linux/ . Unfortunately I'm getting errors saying that go get is no longer supported outside a module.
Steps to Reproduce
- Tried to install it using the go get command:
kramer65@laptop:~$ go get -u -d gocv.io/x/gocv
go: go.mod file not found in current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd@latest'
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.
- I then tried installing using
go install
:
kramer65@laptop:~$ go install gocv.io/x/gocv@latest
package gocv.io/x/gocv is not a main package
- And from here I'm kinda lost. Any tips are welcome.
Your Environment
- Operating System and version: Ubuntu 20.04
- OpenCV version used: None yet. Wanted to install it using the makefile
- How did you install OpenCV? Not yet
- GoCV version used: latest
- Go version: go1.18.5 linux/amd64
- Did you run the
env.sh
orenv.cmd
script before trying togo run
orgo build
? No. I didn't reach that point yet.
You have to use go mod init YOUR_MODULE_NAME
to initialize first.