作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经在我的 Ubuntu 18.04.3 机器上安装了 pybind11(有几种不同的方式,包括 pip 和包管理器),但是当我尝试以推荐的方式指定包含文件时:
python3 -m pybind11 --includes
我收到这个错误:
/usr/bin/python3:没有名为 pybind11.__main__ 的模块; 'pybind11'是一个包,不能直接执行
我发现这个错误的唯一地方是一个中文网页,它对解决问题没有帮助。如何让 pybind11 工作?
回答下面的一些问题:
>>> import pybind11; print(pybind11.__file__)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pybind11' has no attribute '__file__'
> python3 -m pip install pybind11
WARNING: The directory '/home/<username>/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pybind11 in /usr/local/lib/python3.6/dist-packages (2.5.0)
> sudo pip3 -V
pip 20.0.2 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
> python3 -V
Python 3.6.8
最佳答案
试试这个命令。
export PYTHONPATH=$PYTHONPATH:/home/xxx/pybind11
关于python - 安装pybind11后"No module named pybind11",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61235727/
我是一名优秀的程序员,十分优秀!