【发布时间】:2021-08-05 22:30:24
【问题描述】:
我正在尝试在带有 M1 处理器 (Big Sur v11.3) 的 Macbook 上运行 Quantlib-Python,遵循 https://www.quantlib.org/install/macosx-python.shtml。我已经设法通过自制软件安装了 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.gzcd QuantLib-SWIG-1.22/Pythonexport 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
我已经为 boost 问题尝试了很多解决方法,并查看了许多其他问题/答案,但尚未找到解决方法。是不是flag的问题?有没有人有幸让 QuantLib-Python 在基于 M1 的 OSX 上工作?
【问题讨论】:
-
我能够在安装项目后构建项目,并通过 brew 提升 (
brew install boost) 然后在 MacOS 11.3 上使用 quantlib.org 上的步骤 -python setup.py install在构建完成后得到 pip 满意