安装对象检测期间 Protobuf 库编译错误 API Ubuntu

Error in Protobuf libraries compilation during installing Object Detection API Ubuntu

我在安装对象检测时遇到错误 api 并尝试使用此线程 https://github.com/tensorflow/models/issues/1570 中的以下解决方案。

mkdir -p ~/installs/protoc_3.3.0
    cd ~/installs/protoc_3.3.0
    wget https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
    chmod 775 protoc-3.3.0-linux-x86_64.zip
    unzip protoc-3.3.0-linux-x86_64.zip

然后:

    cd ~/git/models/
    ~/installs/protoc_3.3.0/bin/protoc object_detection/protos/*.proto --python_out=.
    python setup.py install --prefix=~

但是上面最后一行代码出现以下错误。

python setup.py install --prefix=~
running install
Checking .pth file support in /home/ayshine/lib/python3.7/site-packages/
/home/ayshine/anaconda3/bin/python -E -c pass
TEST FAILED: /home/ayshine/lib/python3.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /home/ayshine/lib/python3.7/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations


Please make the appropriate changes for your system and try again.

安装这篇博文中描述的 protobuf 解决了我的问题。 https://pythonprogramming.net/introduction-use-tensorflow-object-detection-api-tutorial/