pybind11运行测试用例 [英] pybind11 running the test cases

查看:69
本文介绍了pybind11运行测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习 pybind11 ,第一个Google结果是此页面中,我通过以下方式安装了 bybind11 :

I'm trying to learn pybind11 and the first Google result is this page, where you should be guided towards compiling and running some test cases. From this page, I have installed bybind11 by:

pip3 install pybind11

我已经安装:

sudo apt install python3-dev cmake

按照原始页面中的说明进行操作.但是我不知道下一步该怎么做

as instructed in the original page. But I don't know how to go to the next step which is to

mkdir build ...

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

and the rest of the steps to compile the test cases. I suppose this should be inside the pybind11 installation folder installed via pip3.

我的环境是:

  • Ubuntu 18.04.3 LTS仿生
  • Python3 3.6.9
  • 点20.0.2

我的问题是:

  • 假定的测试用例的路径在哪里,我可以按照其余的教程来自
  • 这是安装pybind11的正确/最佳方法吗?如果不是,推荐的安装方法是什么?

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

P.S.1. using pip3 show pybind11 I realized that I have version 2.4.3 installed and the installation folder is /usr/<userName>/.local/lib/python3.6/sitepackages. However, inside the pybind11 folder there are no test cases as far as I can see.

PS2.此处,我通过 sudo apt install python-pybind11 从这里使用 dpkg --listfiles python-pybind11 安装文件夹位于/usr/lib/python2.7/dist-packages/.不仅在此文件夹中没有测试用例,而且这也是我不想使用的python2.7!

P.S.2. From here I installed via sudo apt install python-pybind11 and from here using dpkg --listfiles python-pybind11 I found the installation folder at /usr/lib/python2.7/dist-packages/. Not only there are no test cases in this folder either, but this is also python2.7 which I don't want to use!

推荐答案

您需要按照pybind11 >此处(通过克隆GitHub存储库):

You need to install pybind11 as instructed here by cloning the GitHub repository:

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 开始.

Then you can run the tests by going to the folder cd tests. Next, follow steps in the tutorial, starting with mkdir build.

PS ,您可能还需要确保您的Python软件包是最新的,请遵循

P.S. You may also need to make sure your Python packages are uptodate, follwing the instructions here.

这篇关于pybind11运行测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆