- Python: python 3.7 ~ python 3.11.x version(if you OS is windows, you can use python installer).
首先你要准备好python环境,下载python installer程序并安装,我使用的是3.11.x版本
Python Installerwww.python.org/downloads/
- Download the CUDA & TensorRT & cudNN Files, in this step, you need have a Nvidia account.
下载CUDA、TensorRT和cudNN文件,CUDA是安装程序,TensorRT和cudNN是zip文件
CUDA : developer.nvidia.com/cuda-11-8-0…
TensorRT : developer.nvidia.com/tensorrt-do…
cudNN : developer.nvidia.com/rdp/cudnn-a…
- Open CUDA installer & install it, you will see the folder in your system disk:
打开下载好的CUDA安装程序,安装后它应该在系统盘的以下位置:
- Unzip the TensorRT zip file and use "cmd" window to install the following(like: pip install xxx.whl):
解压缩下载的TensorRT文件,并在以下TensorRT的目录中使用pip install xxxxxx.whl方式安装它们
如果你在大陆并且安装的速度很慢,你需要将pip的源设置成国内镜像,例如清华或阿里等
graphsurgeon-0.4.6-py2.py3-none-any.whl
pip install onnx_graphsurgeon-0.3.12-py2.py3-none-any.whl
- Move these folders of TensorRT to the CUDA directory(CUDA location often in this:"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"):
将以下文件夹直接拷贝到刚安装的CUDA目录中,通常CUDA会在你的系统盘位置
TensorRT
CUDA
- In the TensorRT's python folder, you need use "pip install tensorrt-8.6.1-cp311-none-win_amd64.whl" to install it:
tips: my python version is 3.11.x, if you python is not the version, you can use other file to install it.
进入TensorRT的python目录,并使用pip install xxxx-cpxx-xxxxx.whl进行安装,实际使用哪个文件取决于你当前的python和系统环境,例如我是python3.11.xx+windows11, 我会使用tensorrt-8.6.1-cp311-none-win_amd64.whl文件进行安装
- Unzip cudNN files and also move these folder to CUDA folder:
解压缩cudNN文件,并和TensorRT的拷贝步骤一样,将以下这些cudNN目录拷贝至CUDA安装目录
cudNN
- Set & add your system environment path for CUDA & TensorRT:
在以下位置为CUDA、TensorRT和cudNN设置系统环境变量
- OK, Let us have a test, the test sample project in samples folder of TensorRT:
到此,所有的安装步骤结束,你可以使用TensorRT提供的测试项目进行环境检测,不同的测试项目运行方法略有区别,需要先使用"pip install -r requirements.txt"对测试项目基础框架安装
- and we can use "python sample.py" to run the test case and check the environment:
如果你的环境安装顺利,运行该测试项目可以看到以下结果
If you can see these messages, Congratulations!
如果看到以上结果,恭喜你,安装成功!
If no, dont wrroy, send the error messages to me, let me help you.
如果没有安装成功,别着急,给我留言或私信,将错误信息发给我,我会给你更多可以参考的信息
And this is my computer informations:
以下是我的电脑环境:
OS: Windows 11 - Professional version
Python: v3.11.x
CUDA: v11.8
TensorRT: v8.6.x
cudNN: v8.9.6.50