Unable to link against Boost.Python on OS X

可紊 提交于 2019-12-04 11:08:25

The solution I am currently using is to reinstall boost-python without python 2.7 support.

The steps I took were:

  1. Uninstall boost-python if already installed: brew uninstall boost-python.
  2. Install boost-python with python3 support but without python 2.7 support: brew install boost-python --with-python3 --without-python.

In order to use boost-python with python 3 you need to change this in your CMakeLists.txt:

FIND_PACKAGE(Boost COMPONENTS python)

to this:

FIND_PACKAGE(Boost COMPONENTS python3)

That way you can recompile boost with python 2 support and still use python 3.

I'd suggest installing boost-python3 via brew.

You still need to give the minor version number as well and possibly the library path. The following worked for me:

BOOST_LIBRARYDIR=/usr/local/Cellar/boost-python3/1.67.0/lib cmake ..

with CMakeLists.txt (located in ..) containing

FIND_PACKAGE(Boost COMPONENTS python36)

(for Boost 1.67.0 and Python 3.6, obviously).

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