在Python2或Python3下安装Tensorflow Serving

Install Tensorflow Serving in Python2 or Python3

官方教程:

https://www.tensorflow.org/serving/setup

1.安装gRPC

https://grpc.io/docs/quickstart/python.html#install-grpc

2.安装服务依赖包

执行以下代码:

sudo apt-get update && sudo apt-get install -y \

        build-essential \

        curl \

        libcurl3-dev \

        git \

        libfreetype6-dev \

        libpng12-dev \

        libzmq3-dev \

        pkg-config \

        python-dev \

        python-numpy \

        python-pip \

        software-properties-common \

        swig \

        zip \

        zlib1g-dev

3.使用PIP安装Tensorflow Serving

Python2:

pip install tensorflow-serving-api

Python3:

pip install --upgrade tensorflow-serving-api-python3

官方教程中仅提供了Python2的pip安装命令,并表示Python3需要手动编译安装。但本人在尝试编译Tensorflow Serving中反复出现编译错误,只好另寻办法。最终在github的这条issues下找到了pip安装Python3的命令并安装成功。

你可能感兴趣的:(在Python2或Python3下安装Tensorflow Serving)