首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在'apple silicon‘Macbook上运行QuantLib python

在'apple silicon‘Macbook上运行QuantLib python
EN

Stack Overflow用户
提问于 2021-05-16 20:12:16
回答 1查看 144关注 0票数 1

我正在尝试使用https://www.quantlib.org/install/macosx-python.shtml在M1处理器(Big Sur v11.3)的Macbook上运行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

但我得到以下错误:

代码语言:javascript
复制
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

我已经尝试了相当多的boost问题的变通方法,并查看了许多其他问题/答案,但仍未找到解决方法。这是旗帜的问题吗?有人有幸让QuantLib-Python在基于M1的OSX上工作吗?

EN

回答 1

Stack Overflow用户

发布于 2021-11-29 12:18:41

下面是我在一台英磅M1 Max上的工作:

  1. brew install boost

  1. brew install quantlib

  1. download QuantLib-SWIG-1.24.tar

tar xzfv QuantLib-SWIG-1.24.tar

  1. cd QuantLib-SWIG-1.24/Python

export CXXFLAGS='-O2 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9 -I/opt/homebrew/Cellar/boost/1.76.0/include'

export LDFLAGS='-stdlib=libc++ -mmacosx-version-min=10.9 -L/opt/homebrew/Cellar/boost/1.76.0/lib'

  1. python setup.py build

python setup.py bdist_wheel

  1. cd dist

pip install QuantLib-1.24-cp310-cp310-macosx_11_0_arm64.whl

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67556513

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档