2

python | TA-Lib 安装

 1 year ago
source link: https://benpaodewoniu.github.io/2022/10/16/python179/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

TA-Lib 安装。

centos

这里用的 python3 的环境来源于这里

如果直接安装的话

pip3 install ta-lib
 talib/_ta_lib.c:747:28: fatal error: ta-lib/ta_defs.h: No such file or directory
#include "ta-lib/ta_defs.h"
^
compilation terminated.
<string>:77: UserWarning: Cannot find ta-lib library, installation may fail.
error: command '/usr/bin/gcc' failed with exit code 1
[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

查了一下,是因为缺少 python3-dev,但是,centos 没有 python3-dev,需要执行下面的代替

yum install epel-release -y
yum install python34-devel -y

但是,在此运行,并不行,还是上面的错误,于是看了一下

需要先在机器上编译一下。

wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr
make
sudo make install

都执行完后,执行

python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ta-lib

安装成功。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK