Python 3.7 + Visual Studio 2107 + boost 1.69

前端 未结 2 1077
逝去的感伤
逝去的感伤 2021-01-26 02:48

I am trying to get boost 1.69 working with visual studio 2107. My goal is to use Numpy in C++

When I include #include boost/python/numpy.hpp

The err

相关标签:
2条回答
  • 2021-01-26 03:23

    I had the same problem. It seems like Boost python is not supported by python 3.7 vert well.

    Using python 3.6 will solve this problem.

    0 讨论(0)
  • 2021-01-26 03:29

    I have been looking at this issue for months and finally figure out the root cause and solutions. The root cause that boost numpy is not built is because numpy is unable to be imported when ./b2 checks for numpy. As a clue from this post Using boost numpy with visual studio 2019 and python 3.8, you can append --debug-configuration to see the debugging information of boost python building process like this in my PC

    notice: [python-cfg] Checking for NumPy...
    
    notice: [python-cfg] running command 'C:/Anaconda3_Install_Root/envs/my_envs/python -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"'
    

    And, the error comes from ImportError for some reason:

    ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.

    After looking at this post numpy is already installed with Anaconda but I get an ImportError (DLL load failed: The specified module could not be found), I found this import process has to be under python environment such as under conda environment or PyCharm terminal (They both work in my PC) with all the required PATH to be imported. Now I can generate numpy static library with Python 3.8, VS 2019, boost v1.74, Windows 10. The command I use to build boost python is .\b2 --with-python python-debugging=off threading=multi variant=release li nk=static address-model=64 stage --debug-configuration. Hopefully, that will work in yours.

    0 讨论(0)
提交回复
热议问题