Using boost numpy with visual studio 2019 and python 3.8

こ雲淡風輕ζ 提交于 2021-01-28 19:12:01

问题


I want to use Boost Numpy (boost version 1.72) with Visual Studio 2017 and Python 3.8. In my test program which includes I get a link error "boost_numpy38-vc141-mt-gd-x32-1_72.lib". I cannot find the file "boost_numpy38-vc141-mt-gd-x32-1_72.lib" anywhere, it is not created when building the binaries (bootstrap + .\b2) and it is nowhere to be found on the binary repositories at Sourceforge (https://sourceforge.net/projects/boost/files/boost-binaries/ ).

Anybody any clue?


回答1:


Building Boost using the boostrap + .\b2 method will check to make sure that you have numpy installed before building boost_numpy. Make sure that you have numpy installed (python -m pip install numpy).

On my machine, the exact command used by b2 to check if numpy is installed is:

python -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"

You can check the command on your own machine by adding --debug-configuration to the .\b2 command, but it should be the same.

Numpy must be installed for whichever version of Python is used for the above command.




回答2:


Tnx Layne, that was indeed the clue!!

In addition some other clues:
- run 'bootstrap vc141' if you have multiple VS installation and you want to use 2017
- run 'b2.exe --build-type=complete' to get both static and dynamic libraries

Once everything is build you will need
boost_numpy38-vc141-mt-gd-x32-1_72.dll and boost_python38-vc141-mt-gd-x32-1_72.dll to run your program



来源:https://stackoverflow.com/questions/61609980/using-boost-numpy-with-visual-studio-2019-and-python-3-8

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!