pybind11 运行 个测试用例

pybind11 running the test cases

我正在尝试学习 pybind11,第一个 Google 结果是 this page, where you should be guided towards compiling and running some test cases. From this page,我已经通过以下方式安装了 bybind11

pip3 install pybind11

我已经安装了:

sudo apt install python3-dev cmake

按照 the original page 中的说明。但我不知道如何进入下一步

mkdir build ...

以及编译测试用例的其余步骤。我想这应该在通过 pip3 安装的 pybind11 安装文件夹中。

我的环境是:

我的问题是:

P.S.1. 使用 pip3 show pybind11 我意识到我安装了 2.4.3 版本并且安装文件夹是 /usr/<userName>/.local/lib/python3.6/sitepackages.但是,据我所知,在 pybind11 文件夹中没有测试用例。

P.S.2. I installed via sudo apt install python-pybind11 and from here 使用 dpkg --listfiles python-pybind11 我在 /usr/lib/python2.7/dist-packages/ 找到了安装文件夹。这个文件夹里不但没有测试用例,而且这个也是我不想用的python2.7!

您需要按照说明 通过克隆 GitHub 存储库来安装 pybind11

python3 -m pip install pytest numpy scipy
sudo apt install -y cmake python3-dev libeigen3-dev libboost-dev git
git clone https://github.com/pybind/pybind11.git
cd pybind11
cmake -DDOWNLOAD_CATCH=1
mkdir build
cd build
cmake ..
sudo make install
cd ..

然后您可以 运行 转到文件夹 cd tests 进行测试。接下来,按照教程中的步骤操作,从 mkdir build.

开始

P.S. 您可能还需要确保您的 Python 包是最新的,按照说明 here.