找不到名为“ pyopengv”的模块

时间:2020-03-04 14:30:17

标签: python linux cmake

我正在使用Ubunutu LTS 18.04,并尝试为python3安装OpenGV模块。 我已经从其文档中克隆并构建了OpenGV。我坐在python 3的标志上。我在/ usr / local / lib / python3 / dist-packages /文件夹中链接了pyopengv.cpython-36m-x86_64-linux-gnu.so。 而且,它不会导入pyopengv。 我不明白有什么问题。 我将指定我在命令中所做的...

git clone https://github.com/laurentkneip/opengv

cd opengv

mkdir build && cd build && cmake .. && make

git submodule update --init --recursive

cmake .. -DBUILD_PYTHON=ON -DPYBIND11_PYTHON_VERSION=3.6 -DPYTHON_INSTALL_DIR=/usr/local/lib/python3.6/dist-packages

cd /usr/local/lib/python3.7/dist-packages/

ln -s /usr/local/lib/python3/dist-packages/pyopengv.cpython-36m-x86_64-linux-gnu.so

最后我在opengv / python中尝试 python3 tests.py 但仍然会收到错误消息“找不到模块'pyopengv'。

有人知道我在做什么错吗?

1 个答案:

答案 0 :(得分:0)

未找到名为“ pyopengv”的模块

python3 tests.py将在/usr/lib/python3/dist-packages/中查找pyopengv

cmake -DBUILD_PYTHON=ON -DPYBIND11_PYTHON_VERSION=3.6 -DPYTHON_INSTALL_DIR=/usr/lib/python3/dist-packages/ ..或建立指向所需位置的符号链接。

使用/usr/lib/python3/dist-packages/pyopengv.cpython-36m-x86_64-linux-gnu.so进行测试的Ubuntu 18.04

$ python3 tests.py 
Testing relative pose
Done testing relative pose
Testing relative pose ransac
Done testing relative pose ransac
Testing relative pose ransac rotation only
Done testing relative pose ransac rotation only
Testing triangulation
Done testing triangulation

编辑,2020年3月5日

Ubuntu 18.04,完整的构建顺序:

git clone https://github.com/laurentkneip/opengv.git
cd opengv/
git submodule update --init --recursive
mkdir build && cd build/ 
cmake -DBUILD_PYTHON=ON -DPYBIND11_PYTHON_VERSION=3.6 -DPYTHON_INSTALL_DIR=/usr/lib/python3/dist-packages/ ..
make && sudo make install

检查模块位置:

find /usr/lib/ -name pyopengv.cpython-36m-x86_64-linux-gnu.so

/usr/lib/python3/dist-packages/pyopengv.cpython-36m-x86_64-linux-gnu.so

注意:使用“其他Linux操作系统”进行检查→可用的模块位置为/ usr / lib64 / python 3.6 / site -packages