ORB_SLAM2-PythonBindings
ORB_SLAM2-PythonBindings copied to clipboard
Install under python3 virtualenv
Can this package installed under python3 virtual environment? I tried to run the following command in cmake:
cmake .. -DCMAKE_INSTALL_PREFIX=/home/xxx/venv
But ImportError appears:
ImportError: No module named 'orbslam2'
Is there a way to install orbslam2
in Python3? Thank you!
Yes - I got it working in a Python 3 virtual environment after adding the path specified in cmake to PYTHONPATH:
export PYTHONPATH=/home/xxx/venv:$PYTHONPATH
Python looks for modules within the /home/xxx/venv/lib/python3.5/site-packages
directory of the virtual environment, rather than the root (/home/xxx/venv/
), so you'd need to point the install prefix there.
Rather than trying to install to the virtual environment, my usual approach is to install to some subdirectory of the repository (say, /opt/ORBSLAM2-PythonBindings/install
), and then add that to the virtual environment using a orbslam.pth
file in /home/xxx/venv/lib/python3.5/site-packages
. Just make a file in that directory with the .pth
extension, and containing only the path /opt/ORBSLAM2-PythonBindings/install
(or wherever you installed it). See https://docs.python.org/3.6/library/site.html
This makes it easy to use one installation of the bindings in many virtual environments.