我在VM上运行Ubuntu Desktop 16.04,并尝试使用标准安装说明运行Volttron,但是在执行以下步骤后,我仍然收到错误消息:
sudo apt-get update
sudo apt-get install build-essential python-dev openssl libssl-dev libevent-dev git
git clone https://github.com/VOLTTRON/volttron
cd volttron
python bootstrap.py
我的问题是最后一步
python bootstrap.py
。一旦执行此步骤,就会从终端窗口中收到错误bootstrap.py: error: refusing to run as root to prevent potential damage.
。还有其他人遇到过这个问题吗?有什么想法吗?
最佳答案
这来自this part of bootstrap.py
(和this commit)
# Refuse to run as root
if not getattr(os, 'getuid', lambda: -1)():
sys.stderr.write('%s: error: refusing to run as root to prevent '
'potential damage.\n' % os.path.basename(argv[0]))
sys.exit(77)
因此,请检查您是否确实有
os.getuid
(当前进程的真实用户ID),因为 getattr
提到:If the named attribute does not exist, default is returned if provided, otherwise
AttributeError
is raised.
参见“What is difference between
os.getuid()
and os.geteuid()
?”。也许您的终端窗口是作为root启动的。 (检查
id -a
的输出)
关于python - Volttron-拒绝以root身份运行以防止潜在损害,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45155336/