简体   繁体   中英

No module named _QuantLib, Quantlib-Python installation

I am trying to install Quantlib-Python on my Mac ( official instructions ), but when I run make -C Python check , I receive an error ImportError: No module named _QuantLib . When I revisit the installation steps it seems like everything is working:

Removing /Library/Python/2.7/site-packages/QuantLib_Python-1.9-py2.7.egg-info
Writing /Library/Python/2.7/site-packages/QuantLib_Python-1.9-py2.7.egg-info

Any idea what is going wrong?

Python might be failing to find your dynamic C++ QuantLib library. It should probably be called libQuantLib.dylib and should be where the dynamic loader can find it; that means that it should be in some standard system location like /usr/lib or /usr/local/lib , or that you should set the environment variable DYLD_LIBRARY_PATH so that it includes its location.

If you only want to use the QuantLib Python module, an easier alternative might be to sidestep dynamic loading. If you clean up your installation (that is, if you remove any libQuantLib.* that you might have installed) and you rebuild the C++ QuantLib by first configuring it as

./configure --disable-shared --enable-static

(plus any other flags you might need), when you run make you'll get a static library. When you rebuild the Python wrappers, the Python module will then embed the QuantLib code itself instead of relying on the presence of the dynamic library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM