我想在我的 debian 操作系统上安装 Universe(python 模块)。 Universe需要golang1.5+。 apt存储库中的那个太旧了,所以我从官方网站安装了它/usr/bin
。我可以使用命令访问它/usr/bin/go/bin
。然后我还将它添加到我的 PATH 中export PATH=$PATH:/usr/bin/go/bin
。现在我只需输入 go 即可运行 go。
$ go version
go version go1.7.4 linux/amd64
现在我想安装 Universe python 模块sudo pip install universe
:不幸的是,这不起作用。
这就是它给出的:
Failed building wheel for go-vncdriver
Running setup.py clean for go-vncdriver
Failed to build go-vncdriver
Installing collected packages: go-vncdriver, PyYAML, universe, requests
Running setup.py install for go-vncdriver ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hND5Mt/go-vncdriver/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-Ob53Rd-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-hND5Mt/go-vncdriver/setup.py", line 79, in <module>
setup_requires=['numpy'],
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
self.run_command('build')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/pip-build-hND5Mt/go-vncdriver/setup.py", line 24, in run
self.check_version()
File "/tmp/pip-build-hND5Mt/go-vncdriver/setup.py", line 43, in check_version
(DETAIL: original error: {}.)""".format(' '.join(cmd), e))
__main__.BuildError:
Unable to execute 'go help build'. HINT: are you sure `go` is installed?
go_vncdriver requires Go version 1.5 or newer. Here are some hints for Go installation:
- Ubuntu 14.04: The default golang is too old, but you can get a modern one via: "sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable && sudo apt-get update && sudo apt-get install golang"
- Ubuntu 16:04: "sudo apt-get install golang"
- OSX, El Capitan or newer: "brew install golang"
- Other: you can obtain a recent Go build from https://golang.org/doc/install
(DETAIL: original error: [Errno 13] Permission denied.)
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hND5Mt/go-vncdriver/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-Ob53Rd-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-hND5Mt/go-vncdriver/
答案1
当您在子 shell 中运行命令时使用的环境sudo
变量$PATH
不一定相同。考虑:
echo $PATH
与
sudo sh #sub-shell as super user
echo $PATH
这两个echo
命令可能不会回显相同的$PATH
.您可以在运行子 shell 之前显式设置路径,也可以将go
二进制文件添加到 root 用户的路径中。
对于选项一,如下:
sudo "PATH=$PATH" pip install universe
应该管用...请参阅有关此主题的其他答案。