CMake can't find my python lib dirs despite being able to find my python executable. As a result, it only builds for my system python2 instead of the python3 for my environment.
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.18", minimum required is "2.7")
-- Found PythonLibs: /home/<user>/.conda/envs/confpaint/lib/libpython3.8.so (found suitable exact version "2.7.18")
-- Found PythonInterp: /home/<user>/.conda/envs/confpaint/bin/python3 (found suitable version "3.8.6", minimum required is "3.2")
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.8.6")
...
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.18)
-- Libraries: /home/<user>/.conda/envs/confpaint/lib/libpython3.8.so (ver 2.7.18)
-- numpy: /home/<user>/.local/lib/python2.7/site-packages/numpy/core/include (ver 1.14.5)
-- install path: lib/python2.7/site-packages/cv2/python-2.7
--
-- Python (for build): /home/<user>/.conda/envs/confpaint/bin/python3
You need to specify the location of the include and library dirs to cmake that correspond to your python version. For example, here is what mine looks like:
cmake -DPYTHON3_LIBRARY=/home/<user>/.conda/envs/confpaint/lib/libpython3.8.so \
-DPYTHON3_INCLUDE_DIRS=/home/<user>/.conda/envs/confpaint/include/python3.8 \
-DPYTHON_DEFAULT_EXECUTABLE=/home/<user>/.conda/envs/confpaint/bin/python3 ..
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.