Centos 6.8 升级Python 3.6 及 pip 10.0 安装 Home Assistant

A] 安装python3.6
1.准备编译环境
cd /usr/local/src
yum groupinstall ‘Development Tools’
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel
2.下载 Python3.5代码包
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz 
3.解压
tar -zxvf Python-3.6.0.tgz 
4.进入解压目录
cd Python-3.6.0
5.编译安装包
./configure –prefix=/usr/local/python
make && make install
6.添加环境变量
echo PATH=’/usr/local/python/bin/:$PATH’ >> /etc/profile
source /etc/profile
7.检查是否成功,执行下面代码
python3.6
Python 3.6.0 (default, Jun  1 2017, 14:01:43) 
[GCC 4.4.7] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> print(‘hello word’)
hello word
B] 安装pip3
1.下载脚本。
wget https://bootstrap.pypa.io/get-pip.py
2.执行安装
python3.6 get-pip.py
3.检查是否成功,执行下面代码
python3.6 -m pip
pip -V
[GCC 4.4.7] on linux
pip 10.0.1 from /usr/local/python/lib/python3.6/site-packages/pip (python 3.6)
 
C] 安装homeassistant
a.直接安装
1.执行安装
pip install homeassistant
2.启动程序
hass –open-ui
b.Python 虚拟环境安装
1.创建虚拟环境
 
python3.6 -m venv homeassistant
2.打开虚拟环境
cd homeassistant
3.激活虚拟环境
source bin/activate
4.安装 Home Assistant
python3.6 -m pip install –upgrade homeassistant
5.启动 Home Assistant 
 hass –open-ui
浏览器: http://IP:8123/states
点赞