python protobuf install for windows

此生再无相见时 提交于 2021-01-28 08:04:17

问题


I am currently trying to install version 3 of google protocol buffer on windows for python.

I have gone to the python folder through the command line and I am attempting to use:
python setup.py build

however I am getting the following error:
python : protoc is not installed nor found in ../src. Please compile it or install the binary package.

What's going on here?


回答1:


As the error says, you must first install protoc.exe. You can get it from the Win32 package included with every Protobuf release. The latest version is here:

https://github.com/google/protobuf/releases/download/v3.0.0-alpha-3/protoc-3.0.0-alpha-3-win32.zip

(You can also build protoc from source by downloading the C++ source code release.)




回答2:


I was able to solve this issue, by following the steps below:

  1. Download the package which contains the precompiled version of Protoc from https://github.com/protocolbuffers/protobuf/releases. You will find the zip file at the bottom, in the assets section (e.g.,protoc-3.14.0-win32.zip)
  2. Add the path of your .exe file which is located inside the bin of the Protoc folder, to the system variables of your system.
  3. Open cmd and go to the directory where you have cloned the source code for the protocol buffer (https://github.com/protocolbuffers/protobuf). Get inside the python folder
  4. Check if python version 2.7 or newer is installed by running the command python -V. If yes then try the command, python setup.py build
  5. python setup.py install
  6. check the installed protoc version with protoc --version


来源:https://stackoverflow.com/questions/31042242/python-protobuf-install-for-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!