D4V1D858 2022-02-26 23:43 采纳率: 100%
浏览 437
已结题

macos 使用pycharm安装ta-lib报错

问题遇到的现象和发生背景

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库

  • 写回答

1条回答 默认 最新

  • ~白+黑 Python领域新星创作者 2022-02-26 23:55
    关注

    先安装这个依赖
    $ brew install ta-lib
    再重新pip install

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 3月3日
  • 已采纳回答 2月27日
  • 创建了问题 2月26日

悬赏问题

  • ¥20 学生成绩管理系统设计
  • ¥15 来一个cc穿盾脚本开发者
  • ¥15 CST2023安装报错
  • ¥15 使用diffusionbert生成文字 结果是PAD和UNK怎么办
  • ¥15 有人懂怎么做大模型的客服系统吗?卡住了卡住了
  • ¥20 firefly-rk3399上启动卡住了
  • ¥15 如何删除这个虚拟音频
  • ¥50 hyper默认的default switch
  • ¥15 网站打不开,提示502 Bad Gateway
  • ¥20 基于MATLAB的绝热压缩空气储能系统代码咨询