TensorRT library call in python from virtualenv

Hi guys,

I was wondering if there was a way to link TensorRT library to a virtualenv to call it as “import tensorrt” ?

I’m on JetsonTX2 jetpack4.4 and obviously TensorRT is installed but I can’t call it from a python script from my virtualenv.

Any idea ?

Thanks

FOUND IT.

You just have to add to PYTHONPATH in .bashrc the path to the file tensorrt.so.
It is normally installed in /usr/lib/python3.6/dist-packages/

So for me it was (inside the .bashrc file or you will have to execute the command each time you re-enter the virtualenv):

export PYTHONPATH=/usr/lib/python3.6/dist-packages:$PYTHONPATH

You can have the full explanation here.

2 Likes