【发布时间】:2021-07-11 02:08:49
【问题描述】:
我有一个 C++ 库,其中包含如下构建的 Python 绑定,以及一个需要导入生成的 libPerceptionPybind.so 的 Python 二进制文件。
package(default_visibility = ["//visibility:public"])
load("@pip_pybind//:requirements.bzl", "requirement")
cc_binary(
name = "PerceptionPybind",
srcs = ["PerceptionPybind.cpp"],
deps = [
"@pybind11",
"@libtorch_cpu//:torch_cpu",
],
linkshared = True,
)
py_binary(
name = "TestPerceptionPybind",
srcs = [ "TestPerceptionPybind.py" ],
deps = [
":PerceptionPybind"
requirement("numpy"),
requirement("torch")
],
)
我看到 libPerceptionPybind.so 已在我的bazel-bin/pybind 文件夹中生成。如您所见,我尝试将PerceptionPybind 添加到deps,但它给出了错误:
//pybind:PerceptionPybind' does not have mandatory providers: 'py' or 'PyInfo
【问题讨论】:
标签: python bazel bazel-rules