ubuntu 从零安装tf-serving环境和opencv

参考官网:https://www.tensorflow.org/serving/setup

首先是安装gprc:

pip install grpcio  

然后发现没有安装pip,报错:
sudo: pip: command not found


好吧,那就先跳过这个,直接执行下一条语句:
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

ok以后,安装 serving api:
 pip install tensorflow-serving-api
报错:
Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python2.7/locale.py", line 581, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

再尝试:pip install grpcio 还是报错:
Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python2.7/locale.py", line 581, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

网上查到解决方法:https://stackoverflow.com/questions/36394101/pip-install-locale-error-unsupported-locale-setting

just run the following command:

$ export LC_ALL=C

Long answer-

Here is my locale settings:

$ locale
LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_PAPER="C" LC_NAME="C" LC_ADDRESS="C" LC_TELEPHONE="C" LC_MEASUREMENT="C" LC_IDENTIFICATION="C" LC_ALL=C
怎么校验嫩?

Python2.7

    $ uname -a
    Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09) x86_64 GNU/Linux $ python --version Python 2.7.9 $ pip --version pip 8.1.1 from /usr/local/lib/python2.7/dist-packages (python 2.7) $ unset LC_ALL $ pip install grpcio Traceback (most recent call last): File "/usr/local/bin/pip", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main locale.setlocale(locale.LC_ALL, '') File "/usr/lib/python2.7/locale.py", line 579, in setlocale return _setlocale(category, locale) locale.Error: unsupported locale setting $ export LC_ALL=C $ pip install grpcio 就可以了

pip install tensorflow-serving-api ok,可以,继续,这个是作为client的用的


接下来
echo "deb [arch=amd64] http://storage.googleapis.com/tensorflow-serving-apt stable tensorflow-model-server tensorflow-model-server-universal" | sudo tee /etc/apt/sources.list.d/tensorflow-serving.list

curl https://storage.googleapis.com/tensorflow-serving-apt/tensorflow-serving.release.pub.gpg | sudo apt-key add -

sudo apt-get update && sudo apt-get install tensorflow-model-server

这样 model  serving 和client 就都ok 啦

 

不过后面执行脚本中用到了opencv,所以这里也加下opencv的安装:

执行 Python ****.py时,报错:

    import cv2
ImportError: No module named cv2

安装:  pip install python-opencv 报错:

Collecting python-opencv
  Could not find a version that satisfies the requirement python-opencv (from versions: )
No matching distribution found for python-opencv
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

好吧,那就升级pip:

pip install --upgrade pip    然后在执行上面的还是没用,那就换个方式安装opencv了:

 

执行:

sudo apt-get install Python-OpenCV  安装了一大堆东西,还是没用

 

要放大招了: sudo apt-get install libopencv-dev

虽然安装了,但是还是没有用,看来只能大大招了:

sudo apt-get install python-opencv

 

然后可以了。。。。。这是什么鬼!!!! 没发现倒数两个只是大小写问题吗!!!!!!!,我也是醉了。

 

 

 

 

 

 

 

 

 
















转载于:https://www.cnblogs.com/YouXiangLiThon/p/8043825.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值