Linux TA_Lib安装
这里写自定义目录标题
- 安装步骤
- 下载
- 解压
- 进入解压目录
- 配置
- 配置
- 编译安装
- 安装python ta-lib
安装步骤
下载
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
配置
./configure --prefix=/usr
编译安装
make && sudo make install
安装python ta-lib
pip install TA-Lib
好了,以上是网上的各种步骤,不过都不能安装成功。
gcc -pthread -B /opt/anaconda3/envs/py37/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -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-gkhba782/normal/lib/python3.7/site-packages/numpy/core/include -I/opt/py37_ssh/include -I/opt/anaconda3/envs/py37/include/python3.7m -c talib/_ta_lib.c -o build/temp.linux-x86_64-cpython-37/talib/_ta_lib.o
In file included from /tmp/pip-build-env-gkhba782/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1969:0,
from /tmp/pip-build-env-gkhba782/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /tmp/pip-build-env-gkhba782/normal/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from talib/_ta_lib.c:1235:
/tmp/pip-build-env-gkhba782/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_5dtype_8itemsize_itemsize’:
talib/_ta_lib.c:10083:3: warning: implicit declaration of function ‘PyDataType_ELSIZE’ [-Wimplicit-function-declaration]
__pyx_r = PyDataType_ELSIZE(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_5dtype_9alignment_alignment’:
talib/_ta_lib.c:10096:3: warning: implicit declaration of function ‘PyDataType_ALIGNMENT’ [-Wimplicit-function-declaration]
__pyx_r = PyDataType_ALIGNMENT(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_5dtype_6fields_fields’:
talib/_ta_lib.c:10113:3: warning: implicit declaration of function ‘PyDataType_FIELDS’ [-Wimplicit-function-declaration]
__pyx_t_1 = PyDataType_FIELDS(__pyx_v_self);
^
talib/_ta_lib.c:10113:13: warning: assignment makes pointer from integer without a cast [enabled by default]
__pyx_t_1 = PyDataType_FIELDS(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_5dtype_5names_names’:
talib/_ta_lib.c:10134:3: warning: implicit declaration of function ‘PyDataType_NAMES’ [-Wimplicit-function-declaration]
__pyx_t_1 = PyDataType_NAMES(__pyx_v_self);
^
talib/_ta_lib.c:10134:13: warning: assignment makes pointer from integer without a cast [enabled by default]
__pyx_t_1 = PyDataType_NAMES(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_5dtype_8subarray_subarray’:
talib/_ta_lib.c:10151:3: warning: implicit declaration of function ‘PyDataType_SUBARRAY’ [-Wimplicit-function-declaration]
__pyx_r = PyDataType_SUBARRAY(__pyx_v_self);
^
talib/_ta_lib.c:10151:11: warning: assignment makes pointer from integer without a cast [enabled by default]
__pyx_r = PyDataType_SUBARRAY(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_5dtype_5flags_flags’:
talib/_ta_lib.c:10164:3: warning: implicit declaration of function ‘PyDataType_FLAGS’ [-Wimplicit-function-declaration]
__pyx_r = PyDataType_FLAGS(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_9broadcast_7numiter_numiter’:
talib/_ta_lib.c:10177:3: warning: implicit declaration of function ‘PyArray_MultiIter_NUMITER’ [-Wimplicit-function-declaration]
__pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_9broadcast_4size_size’:
talib/_ta_lib.c:10190:3: warning: implicit declaration of function ‘PyArray_MultiIter_SIZE’ [-Wimplicit-function-declaration]
__pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_9broadcast_5index_index’:
talib/_ta_lib.c:10203:3: warning: implicit declaration of function ‘PyArray_MultiIter_INDEX’ [-Wimplicit-function-declaration]
__pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_9broadcast_2nd_nd’:
talib/_ta_lib.c:10216:3: warning: implicit declaration of function ‘PyArray_MultiIter_NDIM’ [-Wimplicit-function-declaration]
__pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_9broadcast_10dimensions_dimensions’:
talib/_ta_lib.c:10229:3: warning: implicit declaration of function ‘PyArray_MultiIter_DIMS’ [-Wimplicit-function-declaration]
__pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self);
^
talib/_ta_lib.c:10229:11: warning: assignment makes pointer from integer without a cast [enabled by default]
__pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self);
^
talib/_ta_lib.c: In function ‘__pyx_f_5numpy_9broadcast_5iters_iters’:
talib/_ta_lib.c:10242:3: warning: implicit declaration of function ‘PyArray_MultiIter_ITERS’ [-Wimplicit-function-declaration]
__pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self);
^
talib/_ta_lib.c:10242:11: warning: assignment makes pointer from integer without a cast [enabled by default]
__pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self);
^
gcc -pthread -shared -B /opt/anaconda3/envs/py37/compiler_compat -L/opt/anaconda3/envs/py37/lib -Wl,-rpath=/opt/anaconda3/envs/py37/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-cpython-37/talib/_ta_lib.o -L/usr/lib -L/usr/local/lib -L/usr/lib64 -L/usr/local/lib64 -L/opt/lib -L/opt/local/lib -L/opt/homebrew/lib -L/opt/homebrew/opt/ta-lib/lib -Wl,--enable-new-dtags,-R/usr/lib -Wl,--enable-new-dtags,-R/usr/local/lib -Wl,--enable-new-dtags,-R/usr/lib64 -Wl,--enable-new-dtags,-R/usr/local/lib64 -Wl,--enable-new-dtags,-R/opt/lib -Wl,--enable-new-dtags,-R/opt/local/lib -Wl,--enable-new-dtags,-R/opt/homebrew/lib -Wl,--enable-new-dtags,-R/opt/homebrew/opt/ta-lib/lib -lta-lib -o build/lib.linux-x86_64-cpython-37/talib/_ta_lib.cpython-37m-x86_64-linux-gnu.so
/opt/anaconda3/envs/py37/compiler_compat/ld: cannot find -lta-lib: No such file or directory
collect2: error: ld returned 1 exit status
/tmp/pip-install-b792r0m1/ta-lib_21d1a8b28e334a2190c038cdae0be108/setup.py:75: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
/tmp/pip-build-env-gkhba782/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:69: SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies)
corresp(dist, value, root_dir)
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.
各种报错,也换了各种版本,解决不了。
然后参考别人,使用conda安装成功了。
##安装方法
conda install -c conda-forge ta-lib