我已经在我的 Ubuntu 18.04.3 机器上安装了 pybind11 (几种不同的方式,包括 pip 和包管理器),但是当我尝试以推荐的方式指定包含文件时:
python3 -m pybind11 --includes
我收到此错误:
/usr/bin/python3: No module named pybind11.__main__; 'pybind11' is a package and cannot be directly executed
我发现这个错误的唯一地方是一个中文网页,它对解决问题没有帮助。如何让 pybind11 工作?
回答以下一些问题:
>>> import pybind11; print(pybind11.__file__)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pybind11' has no attribute '__file__'
Run Code Online (Sandbox Code Playgroud)
> 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 …Run Code Online (Sandbox Code Playgroud)