3

我正在尝试 pip install TA-lib 并获取此日志:

> pip install TA-lib
Collecting TA-lib
  Downloading TA-Lib-0.4.10.tar.gz (829kB)
    100% |████████████████████████████████| 839kB 822kB/s 
Building wheels for collected packages: TA-lib
  Running setup.py bdist_wheel for TA-lib ... error
  Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/pip-build-z2UL44/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 /var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmpSTzWMxpip-wheel- --python-tag cp27:
  /private/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/pip-build-z2UL44/TA-lib/setup.py:77: 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.macosx-10.6-intel-2.7
  creating build/lib.macosx-10.6-intel-2.7/talib
  copying talib/__init__.py -> build/lib.macosx-10.6-intel-2.7/talib
  copying talib/deprecated.py -> build/lib.macosx-10.6-intel-2.7/talib
  copying talib/test_abstract.py -> build/lib.macosx-10.6-intel-2.7/talib
  copying talib/test_data.py -> build/lib.macosx-10.6-intel-2.7/talib
  copying talib/test_func.py -> build/lib.macosx-10.6-intel-2.7/talib
  copying talib/test_stream.py -> build/lib.macosx-10.6-intel-2.7/talib
  running build_ext
  building 'talib.common' extension
  creating build/temp.macosx-10.6-intel-2.7
  creating build/temp.macosx-10.6-intel-2.7/talib
  /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c talib/common.c -o build/temp.macosx-10.6-intel-2.7/talib/common.o
  talib/common.c:242:10: fatal error: 'ta-lib/ta_defs.h' file not found
  #include "ta-lib/ta_defs.h"
           ^
  1 error generated.
  error: command '/usr/bin/clang' failed with exit status 1

  ----------------------------------------

>   Failed building wheel for TA-lib   Running setup.py clean for TA-lib
> Failed to build TA-lib Installing collected packages: TA-lib   Running
> setup.py install for TA-lib ... error
>     Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
> -u -c "import setuptools, tokenize;__file__='/private/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/pip-build-z2UL44/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 /var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/pip-lbZkZA-record/install-record.txt
> --single-version-externally-managed --compile:
>     /private/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/pip-build-z2UL44/TA-lib/setup.py:77:
> UserWarning: Cannot find ta-lib library, installation may fail.
>       warnings.warn('Cannot find ta-lib library, installation may fail.')
>     running install
>     running build
>     running build_py
>     creating build
>     creating build/lib.macosx-10.6-intel-2.7
>     creating build/lib.macosx-10.6-intel-2.7/talib
>     copying talib/__init__.py -> build/lib.macosx-10.6-intel-2.7/talib
>     copying talib/deprecated.py -> build/lib.macosx-10.6-intel-2.7/talib
>     copying talib/test_abstract.py -> build/lib.macosx-10.6-intel-2.7/talib
>     copying talib/test_data.py -> build/lib.macosx-10.6-intel-2.7/talib
>     copying talib/test_func.py -> build/lib.macosx-10.6-intel-2.7/talib
>     copying talib/test_stream.py -> build/lib.macosx-10.6-intel-2.7/talib
>     running build_ext
>     building 'talib.common' extension
>     creating build/temp.macosx-10.6-intel-2.7
>     creating build/temp.macosx-10.6-intel-2.7/talib
>     /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
> -I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include
> -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c talib/common.c -o build/temp.macosx-10.6-intel-2.7/talib/common.o
>     talib/common.c:242:10: fatal error: 'ta-lib/ta_defs.h' file not found
>     #include "ta-lib/ta_defs.h"
>              ^
>     1 error generated.
>     error: command '/usr/bin/clang' failed with exit status 1
>     
>     ---------------------------------------- Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
> -u -c "import setuptools, tokenize;__file__='/private/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/pip-build-z2UL44/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 /var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/pip-lbZkZA-record/install-record.txt
> --single-version-externally-managed --compile" failed with error code 1 in
> /private/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/pip-build-z2UL44/TA-lib/

我很不擅长安装东西。这里有一些指导:

https://pypi.python.org/pypi/TA-Lib

但它适用于python3,我在这种故障排除方面没有经验

4

1 回答 1

7

请试试:

brew install ta-lib
pip install numpy
pip install TA-lib

信息来源: https ://github.com/mrjbq7/ta-lib

于 2017-07-04T00:30:03.077 回答