5

I see form my project document that I need to install python-pybind11 by using

sudo apt -y install python-pybind11

but I got error like this:

Reading package lists... Done

Building dependency tree
Reading state information... Done

E: Unable to locate package python-pybind11

I'm not sure if python-pybind11 is a valid package, where can I check it?

Community
  • 1
  • 1

3 Answers3

6

Use this to install pybind11:

pip install pybind11

Refer from Here.

PrakashG
  • 1,642
  • 5
  • 20
  • 30
  • after I run the comand, I got: `Collecting pybind11 Downloading https://files.pythonhosted.org/packages/f2/7c/e71995e59e108799800cb0fce6c4b4927914d7eada0723dd20bae3b51786/pybind11-2.2.4-py2.py3-none-any.whl (145kB) 100% |████████████████████████████████| 153kB 13kB/s Installing collected packages: pybind11 Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pybind11' Consider using the `--user` option or check the permissions. ` –  Feb 16 '19 at 05:35
  • @FeilixXu, Seems to be a permission issue. Run this with “sudo”. – PrakashG Feb 16 '19 at 06:56
  • now another error: `Traceback (most recent call last): File "/usr/bin/pip", line 9, in from pip import main ImportError: cannot import name main `. I'm using ubuntu16, is that related? –  Feb 17 '19 at 13:46
  • 1
    Peanut gallery comment: Please don't `sudo pip install`! Consider `pip install --user`, but really, just try using a `virtualenv`! – eacousineau Mar 08 '19 at 13:35
6

In some systems, you may need

sudo apt -y install python3-pybind11
5

In Ubuntu 18.04

apt-get install python-pybind11

On Mac,

brew install pybind11

In Ubuntu 16.04, you'll need to install yourself. One way is as follows:

# Some prerequisites (but not all of them)
apt-get install cmake
pip3 install pytest

# Clone, build and install 
git clone https://github.com/pybind/pybind11.git 
cd pybind11 
mkdir build 
cd build 
cmake .. 
make install

Reference

TinyTheBrontosaurus
  • 4,010
  • 6
  • 21
  • 34