当我试图在我的mac上安装Ta-lib作为全局包时,我遇到了gcc错误。
我收到以下错误:
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda/include -arch x86_64 -I//anaconda/include -arch x86_64 -I//anaconda/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I//anaconda/include/python3.6m -c talib/common.c -o build/temp.macosx-10.7-x86_64-3.6/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 'gcc' failed with exit status 1
我不确定我理解这句话的意思。pip install Ta-lib包缺少一个文件?这很有道理,但它可以在我的Ubuntu服务器上正常安装,只是在我的Mac上出现了问题。Ubuntu也使用Anaconda运行Python,版本相同。
我的gcc版本如下:
➜ ~ which gcc
/usr/bin/gcc
➜ ~ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
以下是我的Python安装信息:
➜ ~ which python
/anaconda/bin/python
➜ ~ python --version
Python 3.6.1 :: Anaconda custom (x86_64)
我实际上更喜欢将Ta-lib安装为全局conda包,因为我会在大多数临时工作笔记本中使用它。