win10安装home assistant问题

常永长
2023-12-01

使用pip安装homeassistant遇到了下列问题,始终无法成功安装ciso8601

Building wheels for collected packages: ciso8601
  Building wheel for ciso8601 (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for ciso8601 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win32-cpython-39
      creating build\lib.win32-cpython-39\ciso8601
      copying ciso8601\__init__.pyi -> build\lib.win32-cpython-39\ciso8601
      copying ciso8601\py.typed -> build\lib.win32-cpython-39\ciso8601
      running build_ext
      building 'ciso8601' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ciso8601
Failed to build ciso8601
ERROR: Could not build wheels for ciso8601, which is required to install pyproject.toml-based projects

先说一下解决方法:

系统中未安装C++的编译工具,导致pip无法编译相关代码,也就是上述报错信息中的这句提示

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

尝试流程:

1、更新pip和python的版本

2、安装对应的whl文件,不过我搜索了对应的链接,根本没有ciso8601这个whl文件

安装Microsoft C++ Build Tools工具则参考了这个链接:

Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools"的解决办法 - 知乎 (zhihu.com)

安装完编译工具后,在重新安装ciso8610,安装成功

C:\Users\Administrator>pip3 install ciso8601
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting ciso8601
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/db/50/ed16ee9a645196a29d2b7222d77e7d266f63f7a6042f2ac6cbb18a2b98e4/ciso8601-2.2.0.tar.gz (18 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ciso8601
  Building wheel for ciso8601 (pyproject.toml) ... done
  Created wheel for ciso8601: filename=ciso8601-2.2.0-cp39-cp39-win32.whl size=14159 sha256=8589c0945876044d6824c0618f794c8f18be2f01024a090defbf986d7262e870
  Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\67\1f\93\f5d692f0e81d6c353cf764e0e98af724f5b6b8b7a7e587ad31
Successfully built ciso8601
Installing collected packages: ciso8601
Successfully installed ciso8601-2.2.0

建议使用WIN+虚拟机安装home assistant,因为即使win存在兼容性问题,即使安装完成,在运行时会提示:Home Assistant only supports Linux, OSX and Windows using WSL

 类似资料: