能正确安装talib了,但是调用是报错了,是不是numpy版本不对? tqsdk已经自带了numpy,是不是版本不对?
C:\Users\Administrator>pip install ta-lib
Requirement already satisfied: ta-lib in c:\program files\python38\lib\site-packages (0.4.20)
C:\Users\Administrator>pip install numpy
Requirement already satisfied: numpy in c:\program files\python38\lib\site-packages (1.19.4)
C:\Users\Administrator>python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import talib
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
File “C:\Program Files\Python38\lib\site-packages\talib\__init__.py”, line 52, in <module>
from ._ta_lib import (
File “talib\_ta_lib.pyx”, line 1, in init talib._ta_lib
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
如何安装talib?
- 下载对应的TA_Lib.whl文件,保存到\Scripts文件夹。
选择与系统版本、Python版本对应的文件,如TA_Lib‑0.4.10‑cp36‑cp36m‑win_amd64.whl 适用于Windows64位系统, Python3.6版本。
- 安装TA_Lib,运行命令提示符,在Python的Scripts目录下安装wheel,注意输入的.whl文件名与原文件保持一致
- C:\Python\Scripts\pip install TA_Lib‑xxxxx‑cpxxx‑cpxxx‑winxx.whl
- 检验TA_Lib是否安装成功
复制代码
- import talib
没有报错则说明安装成功。
希望tqsdk新增LINEARREG_SLOPE和FORECAST方法,谢谢