我目前正在开发 Nvidia Jetson Nano,我对 Linux 不是很熟悉。我正在尝试运行一个python文件,该文件导入一个名为torch的包。我按照此处NVIDIA 的说明将其与 torchvision 一起安装。
当我pip list
在终端上运行时,我可以看到 torch 被列为已安装的软件包之一。但是,由于下面看到的错误,我无法运行 python 文件。当我尝试在 python shell 上运行它时,会弹出相同的错误。仅供参考:以前它存在问题,因为系统默认使用 python 2,但我已经通过编辑 .bashrc 文件切换到 python 3 修复了路径。
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jiayi/.local/lib/python3.6/site-packages/torch/__init__.py", line 81, in <module>
from torch._C import *
ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory
我尝试通过 pip 卸载和安装,但无济于事。当我尝试安装 pytorch 包时(按照此处github repo 的说明),出现如下所示的错误,这是由于相同的问题。它能够检测到安装了 torch 包,但似乎存在内部问题。
Requirement already satisfied: torch==1.4.0 from file:///home/jiayi/jetson-inference/build/torch-1.4.0-cp36-cp36m-linux_aarch64.whl in /home/jiayi/.local/lib/python3.6/site-packages (1.4.0)
[jetson-inference] cloning torchvision...
[sudo] password for jiayi:
Cloning into 'torchvision-36'...
remote: Enumerating objects: 71, done.
remote: Counting objects: 100% (71/71), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 8219 (delta 37), reused 29 (delta 15), pack-reused 8148
Receiving objects: 100% (8219/8219), 10.22 MiB | 3.60 MiB/s, done.
Resolving deltas: 100% (5631/5631), done.
[jetson-inference] building torchvision for Python 3.6...
Traceback (most recent call last):
File "setup.py", line 14, in <module>
import torch
File "/home/jiayi/.local/lib/python3.6/site-packages/torch/__init__.py", line 81, in <module>
from torch._C import *
ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory
[jetson-inference] installation complete, exiting with status code 0
[jetson-inference] to run this tool again, use the following commands:
$ cd <jetson-inference>/build
$ ./install-pytorch.sh