欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

pybind11 使用问题 01_使用指定的虚拟环境-2 解决方案 2.1 在 cmake 中设置 python 的路径。

最编程 2024-07-15 09:09:39
...
cmake -DPYTHON_LIBRARY=/Users/zhangxin/anaconda3/envs/py36_pytorch041/lib/libpython3.6m.dylib \
    -DPYTHON_INCLUDE_DIR=/Users/zhangxin/anaconda3/envs/py36_pytorch041/include/python3.6 \
    -DPYTHON_EXECUTABLE=/Users/zhangxin/anaconda3/envs/py36_pytorch041/bin/python3.6 \
    ..

输出:

(py36_pytorch041) ➜  build git:(master) ✗ cmake -DPYTHON_LIBRARY=/Users/zhangxin/anaconda3/envs/py36_pytorch041/lib/libpython3.6m.dylib \
    -DPYTHON_INCLUDE_DIR=/Users/zhangxin/anaconda3/envs/py36_pytorch041/include/python3.6 \
    -DPYTHON_EXECUTABLE=/Users/zhangxin/anaconda3/envs/py36_pytorch041/bin/python3.6 \
    ..
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /Users/zhangxin/anaconda3/envs/py36_pytorch041/bin/python3.6 (found version "3.6.9") 
-- Found PythonLibs: /Users/zhangxin/anaconda3/envs/py36_pytorch041/lib/libpython3.6m.dylib
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- pybind11 v2.3.dev0
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/zhangxin/github/pybind11_examples/01_py-list_cpp-vector/build

推荐阅读