使用pip install TA-Lib 时报错:
ERROR: Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-afeznd8w/TA-Lib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-q0lugo3l --python-tag cp35: ERROR: /tmp/pip-install-afeznd8w/TA-Lib/setup.py:79: UserWarning: Cannot find ta-lib library, installation may fail. warnings.warn('Cannot find ta-lib library, installation may fail.') running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.5 creating build/lib.linux-x86_64-3.5/talib copying talib/test_data.py -> build/lib.linux-x86_64-3.5/talib copying talib/test_func.py -> build/lib.linux-x86_64-3.5/talib copying talib/abstract.py -> build/lib.linux-x86_64-3.5/talib copying talib/test_abstract.py -> build/lib.linux-x86_64-3.5/talib copying talib/test_stream.py -> build/lib.linux-x86_64-3.5/talib copying talib/__init__.py -> build/lib.linux-x86_64-3.5/talib copying talib/stream.py -> build/lib.linux-x86_64-3.5/talib copying talib/deprecated.py -> build/lib.linux-x86_64-3.5/talib copying talib/test_pandas.py -> build/lib.linux-x86_64-3.5/talib running build_ext building 'talib._ta_lib' extension creating build/temp.linux-x86_64-3.5 creating build/temp.linux-x86_64-3.5/talib x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.5/dist-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/usr/include/python3.5m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.5/talib/_ta_lib.o talib/_ta_lib.c:526:28: fatal error: ta-lib/ta_defs.h: 没有那个文件或目录 compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- ERROR: Failed building wheel for TA-Lib
解决方案:
- sudo apt-get install libssl-dev libffi-dev python-dev build-essential libxml2-dev libxslt1-dev
- sudo pip install TA-Lib