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

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日

悬赏问题

  • ¥15 openpcdet自制数据集评估bev精度和3d精度相同
  • ¥15 excel 上下按钮 显示行
  • ¥20 云卓h12pro 数传问题
  • ¥20 请问有人知道怎么用工艺库里面的sdb文件通过virtuoso导出来library里面每个cell的symbol吗?
  • ¥20 海思 nnie 编译 报错
  • ¥50 决策面并仿真,要求有仿真结果图
  • ¥15 关于路由器的路由协议配置
  • ¥15 springboot接入微信支付SDK
  • ¥50 大区域的遥感影像匹配 怎么做啊
  • ¥15 求解答:pytorch跑yolov8神经网络受挫