文章目录
背景
我在运行项目:https://github.com/wang-xinyu/tensorrtx/tree/master/yolov7/yolov7_trt.py时,遇到报错:
Traceback (most recent call last):
File "yolov7_trt.py", line 17, in <module>
import tensorrt as trt
ModuleNotFoundError: No module named 'tensorrt'
在执行完:
sudo apt update
sudo apt install nvidia-tensorrt
还是出现如下类似错误:
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting nvidia-tensorrt
Downloading nvidia-tensorrt-0.0.1.dev5.tar.gz (7.9 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-t6193kze/nvidia-tensorrt_0e4a9b978c63427fb703eefcc65ff71c/setup.py", line 150, in <module>
raise RuntimeError(open("ERROR.txt", "r").read())
RuntimeError:
###########################################################################################
The package you are trying to install is only a placeholder project on PyPI.org repository.
This package is hosted on NVIDIA Python Package Index.
This package can be installed as:
```
$ pip install nvidia-pyindex
$ pip install nvidia-tensorrt
```
###########################################################################################
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.