1,下载tensorrt的官方镜像
docker pull nvcr.io/nvidia/tensorrt:21.05-py3
2,创建容器
docker run -itd --gpus all --rm --network=host <REPOSITORY:TAG> /bin/bash
3,cd /workspace/tensorrt/samples/python/engine_refit_mnist
4,安装依赖的包
pip3 install --upgrade pip
pip3 install -r requirements.txt
5,运行sample.py
python3 sample.py [-d DATA_DIR]