uoip / g2opy

Python binding of SLAM graph optimization framework g2o
668 stars 176 forks source link

FindPythonLibsNew.cmake always finds wrong python version #56

Closed rancheng closed 3 years ago

rancheng commented 3 years ago

I always get the pybind find the wrong version of python, the output is:

-- PythonLibsNew_FIND_VERSION: 3.6
-- Found Python: /usr/bin/python3.6 (found suitable version "3.6.9", minimum required is "3.8") found components: Interpreter 

What I want is a virtual environment installed in /venv/bin/python3.8

rancheng commented 3 years ago

I found this problem is introduced from pybind11, there is a duplicated issue:

#2154

This command solved this issue:

cmake .. -DPYTHON_EXECUTABLE=$(which python)
rancheng commented 3 years ago

Here is the compiled library for python 3.8:

g2o.cpython-38-x86_64-linux-gnu.zip pangolin.cpython-38-x86_64-linux-gnu.zip

decompress the zip files and copy the .so files to the system library:

copying ./g2o.cpython-38-x86_64-linux-gnu.so -> /venv/lib/python3.8/site-packages

and verify the library by run:

import g2o