【玩转PointPillars】虚拟环境中import tensorrt报错

      主机中已经下载安装好了TensorRT-7.1.3.4,为了部署PointPillars创建被虚拟环境,在虚拟环境中导入tensorrt python包的时候报"No module named 'tensorrt'。

(pointpillars) node8:~$ ipython
Python 3.6.10 |Anaconda, Inc.| (default, May  8 2020, 02:54:21) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import tensorrt                                                                                    
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
 in 
----> 1 import tensorrt

ModuleNotFoundError: No module named 'tensorrt'

这是因为虽然我安装了TensortRT的库,但还没有安装tensorrt python包,只要重新下载TensorRT-7.1.3.4的tar包,从中手动安装tensorrt python包即可。

注:TensorRT是由C++、CUDA、python三种语言编写成的一个库,其中核心代码为C++和CUDA,Python端作为前端与用户交互。当然,TensorRT也是支持C++前端的,如果我们追求高性能,C++前端调用TensorRT是必不可少的。

#下载

TensorRT-7.1.3.4.Ubuntu-16.04.x86_64-gnu.cuda-10.2.cudnn8.0.tar.gz

#解压

tar -xzvf TensorRT-7.1.3.4.Ubuntu-16.04.x86_64-gnu.cuda-10.2.cudnn8.0.tar.gz

#安装,注意选择好对应的.whl文件

cd TensorRT-7.1.3.4/python/

pip install tensorrt-7.1.3.4-cp36-none-linux_x86_64.whl

#测试

(pointpillars) node8:~/repository$ ipython
Python 3.6.10 |Anaconda, Inc.| (default, May  8 2020, 02:54:21) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import tensorrt                                                                                    

In [2]: tensorrt.__version__                                                                               
Out[2]: '7.1.3.4'

In [3]: tensorrt
Out[3]:

你可能感兴趣的:(点云处理)