请选择 进入手机版 | 继续访问电脑版

『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 2531|回复: 2

ubuntu16.04升级python到3.6安装homeassistant异常

[复制链接]

2

主题

10

帖子

67

积分

论坛分享达人

积分
67
金钱
57
HASS币
0
发表于 2020-3-18 23:15:59 | 显示全部楼层 |阅读模式
本帖最后由 赫山老妖 于 2020-3-18 23:20 编辑

ubuntu16.04升级python到3.6安装homeassistant异常


因ubuntu16.04自带的python3.5.2,不符合ha安装的python3.5.3的要求
自行修改安装好python3.6


按大佬的无坑版安装教程
(20180630更新)Ubuntu安装HomeAssistant教程(ubuntu17.10无坑版)


(ha_venv) homeassistant@NanoPi-NEO-Core:/srv/homeassistant$ pip3 install homeassistant
Collecting homeassistant
  Using cached homeassistant-0.103.6-py3-none-any.whl (6.0 MB)
Collecting contextvars==2.4; python_version < "3.7"
  Using cached contextvars-2.4.tar.gz (9.6 kB)
Collecting python-slugify==4.0.0
  Using cached python-slugify-4.0.0.tar.gz (8.8 kB)
Collecting pyyaml==5.1.2
  Using cached PyYAML-5.1.2.tar.gz (265 kB)
Collecting attrs==19.3.0
  Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Requirement already satisfied: certifi>=2019.9.11 in ./ha_venv/lib/python3.6/site-packages (from homeassistant) (2019.11.28)
Collecting importlib-metadata==0.23
  Using cached importlib_metadata-0.23-py2.py3-none-any.whl (28 kB)
Collecting jinja2>=2.10.3
  Using cached Jinja2-2.11.1-py2.py3-none-any.whl (126 kB)
Collecting cryptography==2.8
  Using cached cryptography-2.8.tar.gz (504 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /srv/homeassistant/ha_venv/bin/python3 /srv/homeassistant/ha_venv/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-__tt9obx/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"''
       cwd: None
  Complete output (51 lines):
  Collecting setuptools>=40.6.0
    Using cached setuptools-46.0.0-py3-none-any.whl (582 kB)
  Collecting wheel
    Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
  Collecting cffi!=1.11.3,>=1.8
    Using cached cffi-1.14.0.tar.gz (463 kB)
  Collecting pycparser
    Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
  Installing collected packages: setuptools, wheel, pycparser, cffi
      Running setup.py install for cffi: started
      Running setup.py install for cffi: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /srv/homeassistant/ha_venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8kvvhfi7/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8kvvhfi7/cffi/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-record-orwyu7h7/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-__tt9obx/overlay --compile --install-headers /srv/homeassistant/ha_venv/include/site/python3.6/cffi
           cwd: /tmp/pip-install-8kvvhfi7/cffi/
      Complete output (34 lines):
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-armv7l-3.6
      creating build/lib.linux-armv7l-3.6/cffi
      copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/model.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/commontypes.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/error.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/cparser.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/api.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/lock.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/__init__.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/verifier.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/recompiler.py -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/_embedding.h -> build/lib.linux-armv7l-3.6/cffi
      copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.6/cffi
      running build_ext
      building '_cffi_backend' extension
      creating build/temp.linux-armv7l-3.6
      creating build/temp.linux-armv7l-3.6/c
      arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/srv/homeassistant/ha_venv/include -I/usr/include/python3.6m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.6/c/_cffi_backend.o
      c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
      compilation terminated.
      error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /srv/homeassistant/ha_venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8kvvhfi7/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8kvvhfi7/cffi/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-record-orwyu7h7/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-__tt9obx/overlay --compile --install-headers /srv/homeassistant/ha_venv/include/site/python3.6/cffi Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /srv/homeassistant/ha_venv/bin/python3 /srv/homeassistant/ha_venv/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-__tt9obx/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
(ha_venv) homeassistant@NanoPi-NEO-Core:/srv/homeassistant$

请各位大神不吝指点迷津,折腾好几天了呵。
补充说明下:
在系统下环境下 sudo apt-get install python3-cffi 正常
在虚拟环境下,pip3 install --upgrade setuptools==40.6.0  或 pip3 install --upgrade setuptools 均安装正常
在虚拟环境下,pip3 install --upgrade cffi或指定版本,无法通过。不知道问题在哪呵。


回复

使用道具 举报

40

主题

3057

帖子

1万

积分

超级版主

Nero

Rank: 8Rank: 8

积分
11135
金钱
8028
HASS币
182
发表于 2020-3-19 09:21:15 | 显示全部楼层
建议装在 venv 里面,HA 官方教程也是教装在 venv 下。防止和系统的python冲突。
另外 docker 不香吗?
Nero
回复

使用道具 举报

2

主题

10

帖子

67

积分

论坛分享达人

积分
67
金钱
57
HASS币
0
 楼主| 发表于 2020-3-19 09:27:19 | 显示全部楼层
本帖最后由 赫山老妖 于 2020-3-19 23:08 编辑
neroxps 发表于 2020-3-19 09:21
建议装在 venv 里面,HA 官方教程也是教装在 venv 下。防止和系统的python冲突。
另外 docker 不香吗?
...

(ha_venv) 已显示了是虚拟环境
资源有限,内存256MB,且和其他一些应用共存,不知道docker开销影响大不大
通过反复测试研究,是我的系统缺少python3.6-dev。安装已解决前面出现的问题,目前正在处理其他缺少的依赖。

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-3-29 09:34 , Processed in 0.050023 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表