Skip to content

Instantly share code, notes, and snippets.

@willwhui
Created November 1, 2017 14:47
Show Gist options
  • Save willwhui/149640a22e43c86d506ae6052bc191f9 to your computer and use it in GitHub Desktop.
Save willwhui/149640a22e43c86d506ae6052bc191f9 to your computer and use it in GitHub Desktop.
@willwhui
Copy link
Author

willwhui commented Nov 1, 2017

有人说比较麻烦?

这里有一个简单的组件帮忙:https://github.com/dale3h/hassctl

实际上按照官方的说明并不麻烦

https://home-assistant.io/docs/installation/updating/

@willwhui
Copy link
Author

willwhui commented Nov 6, 2017

按官方说明进行升级:

# 进入账户
sudo su homeassistant
# 进入虚拟环境
source /srv/homeassistant/bin/activate
# 升级
pip3 install --upgrade homeassistant

梯子不好会失败。
需要回到墙内做以上操作。
如果墙内速度慢的话,参考这里更改一些源:https://home-assistant.cc/cn/source/
我目前不改的速度还可以。

但是还是遇到问题:

error: invalid command 'bdist_wheel'

根据这里:
https://stackoverflow.com/questions/26664102/why-can-i-not-create-a-wheel-in-python
把wheel安装一下,注意,必须在虚拟环境中安装

然后遇到新问题

Exception:
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/commands/install.py", line 360, in run
    prefix=options.prefix_path,
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 329, in clobber
    os.utime(destfile, (st.st_atime, st.st_mtime))
PermissionError: [Errno 1] Operation not permitted

根据这里 https://stackoverflow.com/questions/10937806/oserror-error-1-operation-not-permitted 说的改一下:

sudo chown -R homeassistant:homeassistant /srv/homeassistant/lib

然后再试一次升级(虚拟环境下):
pip3 install --upgrade homeassistant
就成功了。

不过把那些文件的权限改了,有不安全的因素。以后重装吧。

但是不知道为什么我这里有这些问题???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment