问题遇到的现象和发生背景
mac系统,pycharm下使用terminal运行pip3 install TA-Lib报错
问题相关代码,请勿粘贴截图
pip3 install TA-Lib
运行结果及报错内容
Collecting TA-Lib
Using cached TA-Lib-0.4.24.tar.gz (269 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in ./venv/lib/python3.8/site-packages (from TA-Lib) (1.22.2)
Building wheels for collected packages: TA-Lib
Building wheel for TA-Lib (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
/private/var/folders/03/5_dgs9kx0hndtp3t0ldg2b340000gn/T/pip-install-k5yvww0e/ta-lib_c544a3ebe0cb4c75bb01cb3557a17177/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.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/abstract.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_polars.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_abstract.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/deprecated.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/init.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/stream.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_pandas.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_data.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_func.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_stream.py -> build/lib.macosx-10.9-x86_64-3.8/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/talib
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -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/Users/jy.han/PycharmProjects/Binance BTC/USDT API Tradebot/venv/lib/python3.8/site-packages/numpy/core/include -I/Users/jy.han/PycharmProjects/Binance BTC/USDT API Tradebot/venv/include -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c talib/_ta_lib.c -o build/temp.macosx-10.9-x86_64-3.8/talib/_ta_lib.o
talib/_ta_lib.c:682:10: fatal error: 'ta-lib/ta_defs.h' file not found
#include "ta-lib/ta_defs.h"
^~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: 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
error: subprocess-exited-with-error
× Running setup.py install for TA-Lib did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
/private/var/folders/03/5_dgs9kx0hndtp3t0ldg2b340000gn/T/pip-install-k5yvww0e/ta-lib_c544a3ebe0cb4c75bb01cb3557a17177/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.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/abstract.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_polars.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_abstract.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/deprecated.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/init.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/stream.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_pandas.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_data.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_func.py -> build/lib.macosx-10.9-x86_64-3.8/talib
copying talib/test_stream.py -> build/lib.macosx-10.9-x86_64-3.8/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/talib
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -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/Users/jy.han/PycharmProjects/Binance BTC/USDT API Tradebot/venv/lib/python3.8/site-packages/numpy/core/include -I/Users/jy.han/PycharmProjects/Binance BTC/USDT API Tradebot/venv/include -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c talib/_ta_lib.c -o build/temp.macosx-10.9-x86_64-3.8/talib/_ta_lib.o
talib/_ta_lib.c:682:10: fatal error: 'ta-lib/ta_defs.h' file not found
#include "ta-lib/ta_defs.h"
^~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> TA-Lib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
我想要达到的结果
可以使用ta-lib库