docker创建tf环境

1:拉取镜像:

docker pull tensorflow/tensorflow:1.13.1-gpu-py3

2:创建容器(使用tensorflow/tensorflow:latest-gpu-py3镜像):

sudo docker run --name="your name"  --runtime=nvidia -it -v /home/lq/data2_code/YOLOv3_TensorFlow/:/data1   tensorflow/tensorflow:1.13.1-gpu-py3

3:安装opencv-python:

pip install opencv-python

4:opencv报错,解决方法:

ImportError: libSM.so.6: cannot open shared object file: No such file or directory
ImportError: libXrender.so.1: cannot open shared object file: No such file or directory
ImportError: libXext.so.6: cannot open shared object file: No such file or directory

安装对应的软件包解决:

apt-get install libsm6
apt-get install libxrender1
apt-get install libxext-dev 

5:安装cuDNN:下载cudnn-10.0-linux-x64-v7.4.2.24.solitairetheme8(没有路径要求)

解压:命令

cp  cudnn-8.0-linux-x64-v5.1.solitairetheme8 cudnn-8.0-linux-x64-v5.1.tgz
tar -xvf cudnn-8.0-linux-x64-v5.1.tgz

执行拷贝命令:

sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda
    原文作者:wuxxzzz
    原文地址: https://zhuanlan.zhihu.com/p/66585898
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞