AttributeError: module 'tensorrt' has no attribute '__version__'

On jetson NX, when import tensorrt, it occured:
(py3) shisun@ubuntu:~$ python
Python 3.6.9 (default, Mar 15 2022, 13:55:28)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import tensorrt
tensorrt.version
Traceback (most recent call last):
File “”, line 1, in
AttributeError: module ‘tensorrt’ has no attribute ‘version

Hi,

Please use tensorrt.__version__ instead.

$ python3
Python 3.6.9 (default, Mar 15 2022, 13:55:28)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorrt
>>> tensorrt.__version__
'8.2.1.8'
>>>

Thanks.

Thank you for reply.
In fact, what I used is just the same as “tensorrt.version”, on this forum,
it may appeared different. AttributeError: module ‘tensorrt’ has no attribute ‘version’ and still error araised
please give me furthur information.

print(tensorrt)
<module ‘tensorrt’ from ‘/home/shisun/py3/lib/python3.6/tensorrt.so’>

print(tensorrt.version)
Traceback (most recent call last):
File “”, line 1, in
AttributeError: module ‘tensorrt’ has no attribute ‘version

hi,

the problem already solved.

python
Python 3.6.9 (default, Mar 15 2022, 13:55:28)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import tensorrt
tensorrt.version
‘8.2.1.8’

I copied the sub directories about tensorrt under /usr/lib/python3.6/dist-packages/
to my virtual environment ~/py3/lib/python3.6/site-packages/

then it’s ok

thank you.