【发布时间】:2022-01-13 03:06:50
【问题描述】:
我在 grpc/third_party/protobuf/src/google/protobuf 代码中添加了一些日志代码,为了帮助定位问题,我从源代码安装了 grpc python,但是更改没有生效。请给我一些建议,谢谢。
支持的 Python 版本
Python 3.7.9
什么操作系统(Linux、Windows...)和版本?
Ubuntu 18.04.5 LTS
你做了什么?
我在 grpc/third_party/protobuf/src/google/protobuf 代码中添加了一些日志代码,然后我编译了 protobuf ,编译了 grpc 并从源代码安装了 grpc python
mkdir -p "third_party/protobuf/cmake/build"
cd "third_party/protobuf/cmake/build"
cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ..
make -j14 install
popd
make -j14
我修改了 setup.py,添加了这段代码:
CORE_C_FILES = filter(lambda x: 'third_party/protobuf' not in x, CORE_C_FILES)
PROTOBUF_INCLUDE = (os.path.join('/usr', 'include', 'protobuf'),)
EXTENSION_INCLUDE_DIRECTORIES = ((PYTHON_STEM,) + CORE_INCLUDE + ABSL_INCLUDE +
ADDRESS_SORTING_INCLUDE + CARES_INCLUDE +
RE2_INCLUDE + PROTOBUF_INCLUDE + SSL_INCLUDE + UPB_INCLUDE +
UPB_GRPC_GENERATED_INCLUDE +
UPBDEFS_GRPC_GENERATED_INCLUDE +
XXHASH_INCLUDE + ZLIB_INCLUDE)
然后我运行:
pip install -rrequirements.txt
GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .
我很困惑,为什么对 Protobuf 的更改不起作用?可能是我的安装方法有问题,请给我一些建议,谢谢。
【问题讨论】:
标签: python grpc grpc-python