mac如何安装talib

mac下pip安装ta-lib会报错

 Running setup.py install for ta-lib ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gk/sw9sly3x5w3_mspdt4h8tm380000gn/T/pip-install-1emRyO/ta-lib/setup.py'"'"'; __file__='"'"'/private/var/folders/gk/sw9sly3x5w3_mspdt4h8tm380000gn/T/pip-install-1emRyO/ta-lib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/gk/sw9sly3x5w3_mspdt4h8tm380000gn/T/pip-record-wXGPIe/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/huchao/Library/Python/2.7/include/python2.7/ta-lib
         cwd: /private/var/folders/gk/sw9sly3x5w3_mspdt4h8tm380000gn/T/pip-install-1emRyO/ta-lib/
    Complete output (27 lines):
    /private/var/folders/gk/sw9sly3x5w3_mspdt4h8tm380000gn/T/pip-install-1emRyO/ta-lib/setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
      warnings.warn('Cannot find ta-lib library, installation may fail.')

报错的原因是缺少ta-lib library,看起来是编译时候缺少链接库。需要安装ta-lib静态库,于是使用brew安装一下ta-lib。

brew install ta-lib

安装完毕之后就可以pip install ta-lib,就可以安装成功了。

赞赏

微信赞赏支付宝赞赏

发表评论

电子邮件地址不会被公开。 必填项已用*标注