于 Linux 使用 Python PIP3 安装 TA-Lib

..

Python3 的 TA-Lib 有很多技术分析的函数(Function) 已经写好,可以直接套用。

不过 TA-Lib 于 Debian Linux 要直接 pip3 install 会遇到点困难~

于 Linux 使用 Python PIP3 安装 TA-Lib

官网:TA-Lib : Technical Analysis Library - Home

使用 pip3 install TA-lib 会遇到下述问题:

  • pip3 install TA-lib
    • x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=.  -fstack-protector-strong -Wform at -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/opt/homebrew/include -I/opt/homebrew/opt/ta-lib/include -I/tmp/pip- build-env-n6c_g8d2/normal/lib/python3.9/site-packages/numpy/core/include -I/usr/include/python3.9 -c talib/talib.c -o build/temp.linux-x86_64-cpython-39/talib/talib.o                                                                    talib/talib.c:747:10: fatal error: ta-lib/ta_defs.h: 没有此一档案或目录                                                                                       747 | #include "ta-lib/ta_defs.h"     |          ^~~~~~   compilation terminated.   error: command '/usr/bin/x86_64-linux-gnu-gcc' failed   with exit code 1   ----------------------------------------   ERROR: Failed building wheel for Ta-Lib Failed to build Ta-Lib ERROR: Could not build wheels for Ta-Lib which use PEP 517 and cannot be installed directly

于 Debian Linux 使用 PIP3 安装 TA-Lib 步骤

  1. 先到官网的下载页面:TA-Lib Technical Analysis Library - Download,下载 ta-lib-0.4.0-src.tar.gz
  2. wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz # 这个就是从官网下载的连结
  3. tar -xzf ta-lib-0.4.0-src.tar.gz
  4. cd ta-lib/
  5. ./configure --prefix=/usr
  6. make
  7. sudo make install # 会安装 Library 到这些地方
    • ls /usr/lib/libta_lib.
      • /usr/lib/libta_lib.a # 主要用这个
      • /usr/lib/libta_lib.la
      • /usr/lib/libta_lib.so
      • /usr/lib/libta_lib.so.0
      • /usr/lib/libta_lib.so.0.0.0
  8. pip3 install TA-lib # 再来就可以使用 pip 安装 TA-lib,就可以正常完成了~
    • Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from TA-lib)
    • Stored in directory: /home/user/.cache/pip/wheels/08/d3/5c/8866d2115d6b73b448af7f8e361bf267a1d82b87e318bxxxxx
    • Successfully built TA-lib
    • Installing collected packages: TA-lib

相关网页

想在手机阅读更多程式设计资讯?下载【香港硅谷】Android应用
分享到Facebook