python安装ta-lib失败

python安装ta-lib失败,有可能会报错

Requirement already satisfied: numpy in c:\users\viruser.v-desktop\.virtualenvs\stockstudy-jtfklg50\lib\site-packages (from ta-lib) (1.24.2)
Building wheels for collected packages: ta-lib
  Building wheel for ta-lib (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for ta-lib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build\lib.win-amd64-cpython-38\talib
      copying talib\abstract.py -> build\lib.win-amd64-cpython-38\talib
      copying talib\deprecated.py -> build\lib.win-amd64-cpython-38\talib
      copying talib\stream.py -> build\lib.win-amd64-cpython-38\talib
      copying talib\__init__.py -> build\lib.win-amd64-cpython-38\talib
      running build_ext
      building 'talib._ta_lib' extension
      <string>:75: UserWarning: Cannot find ta-lib library, installation may fail.
      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 ta-lib
Failed to build ta-lib
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (ta-lib)

网上搜索了相关的解决方案,基本都是访问 lfd.uci.edu/~gohlke/pythonlibs/#ta-lib 当时现在访问不了,页面展示:The page you requested was removed.

经过搜索,可以在github上找到:Releases · cgohlke/talib-build

此地址可以直接下载编译好的ta-lib,下载到本地后,在下载目录执行pip install 对应文件 即可

文件名解释:例:TA_Lib-0.4.32-cp310-cp310-win_amd64.whl

 0.4.32是ta-lib版本
cp310表示安装的python版本是3.10
posted @ 2024-10-21 21:10  天邪小鬼  阅读(161)  评论(0编辑  收藏  举报