安装 tensorrt 清华源
时间: 2024-10-12 10:02:02 浏览: 160
安装TensorRT(TensorFlow Runtime)时,如果你想要使用清华大学的镜像源,可以按照以下步骤操作:
1. 首先,需要确保已安装了Python的基础环境和pip工具。可以在命令行输入`python --version`检查Python版本。
2. 添加清华源到pip的配置文件,通常是在`~/.pip`目录下(如果没有就创建)创建一个名为`config.txt`的文件,并添加以下内容:
```
[global]
index-url = http://pypi.tuna.tsinghua.edu.cn/simple/
trusted-host = pypi.tuna.tsinghua.edu.cn
```
3. 更新pip源列表:
```bash
pip config set global.index-url http://pypi.tuna.tsinghua.edu.cn/simple/
```
4. 然后你可以使用这个新的源安装TensorRT。例如,如果你想安装TensorRT 8.x版本,可以运行:
```bash
pip install tensorrt==8.0.1
```
如果有多个版本需要选择,可以用`pip search tensorrt`查看可用版本。
5. 安装完成后,验证安装是否成功:
```bash
python -c "import tensorrt"
```
阅读全文