繁体   English   中英

安装 pybind11 后出现“没有名为 pybind11 的模块”

[英]“No module named pybind11” after installing pybind11

我已经在我的 Z3D945423F8E9496C429A5D8C65B34604FZ 上安装了 pybind11(几种不同的方式,包括 pip 和 package 管理器),但我尝试指定推荐的方式时包含文件:18.04。

python3 -m pybind11 --includes

我收到此错误:

/usr/bin/python3: No module named pybind11.__main__; 'pybind11' is a package and cannot be directly executed

我发现提到的这个错误的唯一地方是中文 web 页面,它对解决问题没有帮助。 如何让 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM