我在安装对象检测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.
答案 0 :(得分:0)
按本博文所述安装protobuf解决了我的问题。 https://pythonprogramming.net/introduction-use-tensorflow-object-detection-api-tutorial/