安装
快速安装:
apt-get install python3-pip
pip3 install homeassistant
hass
一般安装:
apt install python3.5 python3.5-dev
apt install libpython3.5 libpython3.5-dev
将Python3.5设置为默认Python3:
update-alternatives --install /usr/bin/python python3 /usr/bin/python3.5 1
update-alternatives --config python3
Python 虚拟环境安装:
(Home Assistant 官方推荐使用 Python 虚拟环境安装 Home Assistant 以避免影响生产环境。)
- 创建虚拟环境:python3 -m venv homeassistant
- 打开虚拟环境:cd homeassistant
- 激活虚拟环境:source bin/activate
- 安装 Home Assistant:python3 -m pip install --upgrade homeassistant
- 启动 Home Assistant 并打开网页:hass –open-ui
维护
apt-get update
systemctl stop home-assistant@homeassistant.service
su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install –upgrade homeassistant
exit
systemctl start home-assistant@homeassistant.service
更换pip源
vi /home/root/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple
清华:https://pypi.tuna.tsinghua.edu.cn/simple
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/