【问题标题】:How to apt install python-pybind11?如何安装 python-pybind11?
【发布时间】:2019-02-15 07:38:52
【问题描述】:

我从我的项目文档中看到我需要使用安装python-pybind11

sudo apt -y install python-pybind11

但我得到了这样的错误:

正在读取包列表...完成

构建依赖树
读取状态信息...完成

E: 找不到包 python-pybind11

我不确定python-pybind11 是否是一个有效的包,我在哪里可以检查它?

【问题讨论】:

  • 欢迎您,python-pybind11 是适用于 Ubuntu 18.04 及更高版本的有效软件包。
  • @Felix Xu,你应该接受正确的答案。

标签: ubuntu-16.04 apt pybind11


【解决方案1】:

用这个来安装pybind11:

pip install pybind11

请参考Here

【讨论】:

  • 运行命令后,我得到: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` 选项或检查权限。 `
  • @FeilixXu,似乎是权限问题。用“sudo”运行它。
  • 现在出现另一个错误:Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main ImportError: cannot import name main 。我用的是ubuntu16,有关系吗?
  • 花生画廊评论:请不要sudo pip install!考虑pip install --user,但实际上,只需尝试使用virtualenv
【解决方案2】:

在 Ubuntu 18.04 中

apt-get install python-pybind11

在 Mac 上,

brew install pybind11

在 Ubuntu 16.04 中,您需要自行安装。一种方法如下:

# 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

【讨论】:

  • 我使用了你的指示here
猜你喜欢
  • 1970-01-01
  • 2021-01-14
  • 1970-01-01
  • 2021-06-04
  • 1970-01-01
  • 1970-01-01
  • 2015-05-13
  • 2021-09-08
  • 2018-11-25
相关资源
最近更新 更多