我通过 snap 安装go
;现在我该如何调用pup
?
thufir@dur:~/pup$
thufir@dur:~/pup$ go get github.com/ericchiang/pup
thufir@dur:~/pup$
thufir@dur:~/pup$ curl "skynet.be/nieuws-sport/weer/mijn-weer?cityId=6450" | pup 'div.tides' >out.html
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
Command 'pup' not found, but there are 17 similar ones.
100 268 100 268 0 0 740 0 --:--:-- --:--:-- --:--:-- 740
(23) Failed writing body
thufir@dur:~/pup$
thufir@dur:~/pup$ cat out.html
thufir@dur:~/pup$
thufir@dur:~/pup$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic
thufir@dur:~/pup$
实际上不确定它是否已安装:
thufir@dur:~/pup$
thufir@dur:~/pup$ go list
can't load package: package .: no Go files in /home/thufir/pup
thufir@dur:~/pup$
thufir@dur:~/pup$ go version
go version go1.11.4 linux/amd64
thufir@dur:~/pup$
thufir@dur:~/pup$
thufir@dur:~/pup$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/thufir/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/thufir/go"
GOPROXY=""
GORACE=""
GOROOT="/snap/go/3095"
GOTMPDIR=""
GOTOOLDIR="/snap/go/3095/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build303962824=/tmp/go-build -gno-record-gcc-switches"
thufir@dur:~/pup$
我尝试过逃跑,pup
但~/go/
结果是一样的。
答案1
我在尝试安装 pup 时遇到了同样的问题。
您必须遵循的步骤:
export GOROOT=/usr/bin/go
(发现正在运行的路径whereis go
)转到你的 GOPATH:
cd /home/thufir/go
在那里你会发现垃圾桶文件夹内小狗二进制将二进制文件 p 复制到 /usr/bin/
sudo cp pup /usr/bin
检查 pup 是否正确安装
pup --version
我希望它能起作用。