报错信息
在使用pip install pytorch3d
安装时,显示安装成功,但在运行代码时,报错:
from pytorch3d import _C
ImportError: libcudart.so.10.1: cannot open shared object file: No such file or directory
说明pytorch3d在安装过程中出错了。
原因:使用pip安装的时候,会下载编译好的pytorch3d进行安装,预编译的pytorch3d安装包并不匹配你的当前环境。
解决方案
按照github上pytorch3d的官方安装教程,从源码安装:
Building / installing from source.
1. 从github上直接安装
pip install "git+https://github.com/facebookresearch/pytorch3d.git"
由于我无法成功使用git,放弃这个安装方式。
2. 从本地的clone里安装
首先需要从github上把pytorch3d下载到本地,再进行安装。
(1)下载pytorch3d
git clone https://github.com/facebookresearch/pytorch3d.git
或者直接在github上点击下载
(2)本地安装
cd pytorch3d
pip install -e .
参考:https://blog.csdn.net/YnullW/article/details/126961883