在Jetson等设备上为不同版本的Python打包安装TensorRT

Jetson的TensoRT是板载、对应固定的Python版本的,如果手动安装了不同版本的Python,很难手动安装对应版本的TensorRT。

在这里提供一种方法,利用已有的TensorRT动态库和pybind11,根据Python版本需求制作安装包:

export EXT_PATH=/tmp/tensorrt-bindings
rm -rf $EXT_PATH
mkdir $EXT_PATH
cd $EXT_PATH

git clone https://github.com/pybind/pybind11.git
cd pybind11
git checkout v2.6.2
cd $EXT_PATH

wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz
tar xvzf Python-3.8.13.tgz
mkdir python3.8
cp -r Python-3.8.13/Include/ python3.8/include
cp /usr/include/aarch64-linux-gnu/python3.8/pyconfig.h python3.8/include/

git clone https://github.com/NVIDIA/TensorRT
cd TensorRT
git checkout release/8.0
cd python
CPATH=$EXT_PATH/pybind11/include TRT_OSSPATH=$EXT_PATH/TensorRT \
PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=8 TARGET=aarch64 \
./build.sh

python3 -m pip uninstall tensorrt -y
python3 -m pip install build/dist/tensorrt-*.whl
cd $EXT_PATH

python3 -c "import tensorrt"

https://github.com/mlcommons/inference_results_v2.0/issues/2

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值