在“苹果硅”Macbook 上运行 QuantLib python

时间:2021-05-16 12:12:16

标签: python apple-m1 quantlib

我正在尝试在带有 M1 处理器 (Big Sur v11.3) 的 Macbook 上按照 https://www.quantlib.org/install/macosx-python.shtml 运行 Quantlib-Python。我已经设法通过自制软件安装了 Quantlib 1.22 和 Python 3.9.4:

Pouring quantlib--1.22.arm64_big_sur.bottle.tar.gz 进入“/opt/homebrew/Cellar/quantlib/1.22”

但是,当我尝试通过 pip 安装 Quantlib-Python 时,我得到:

ERROR: Could not find a version that satisfies the requirement QuantLib (from versions: none)
ERROR: No matching distribution found for QuantLib

由此看来,虽然 Quantlib 1.22 已准备好用于基于 arm 的 OSX,但 QuantLib-Python 还没有。

然后我尝试按照上述链接从已发布的版本进行安装:

tar xzf QuantLib-SWIG-1.22.tar.gz
cd QuantLib-SWIG-1.22/Python
export CXXFLAGS='-O2 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9'
export LDFLAGS='-stdlib=libc++ -mmacosx-version-min=10.9'
python setup.py build

但我收到以下错误:

cd QuantLib-SWIG-1.22/Python
  export CXXFLAGS='-O2 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9'
  export LDFLAGS='-stdlib=libc++ -mmacosx-version-min=10.9'
  python setup.py build
running build
running build_py
running build_ext
building 'QuantLib._QuantLib' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -DNDEBUG -I/Users/USER/coding/project1/include -I/Users/USER/.pyenv/versions/3.9.4/include/python3.9 -I/opt/homebrew/Cellar/quantlib/1.22/include -c QuantLib/quantlib_wrap.cpp -o build/temp.macosx-11.3-arm64-3.9/QuantLib/quantlib_wrap.o -Wno-unused -O2 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9
In file included from QuantLib/quantlib_wrap.cpp:4730:
In file included from /opt/homebrew/Cellar/quantlib/1.22/include/ql/version.hpp:28:
/opt/homebrew/Cellar/quantlib/1.22/include/ql/qldefines.hpp:38:10: fatal error: 'boost/config.hpp' file not found
#include <boost/config.hpp>
         ^~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1

我已经尝试了很多解决提升问题的方法,并查看了许多其他问题/答案,但尚未找到解决方法。是不是flag的问题?有没有人有幸让 QuantLib-Python 在基于 M1 的 OSX 上工作?

0 个答案:

没有答案