0

我在我的 jetson nano(jetpack 4.4,Cuda 10.2.89)中导入 PyTorch 时遇到问题,我已经从 .whl 文件成功安装了它,它位于我的 pip3 库中。但是当我导入它时,它会显示此错误。请帮忙。

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/parikshit/.local/lib/python3.6/site-packages/torch/__init__.py", line 188, in <module>
    _load_global_deps()
  File "/home/parikshit/.local/lib/python3.6/site-packages/torch/__init__.py", line 141, in _load_global_deps
    ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
  File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libmpi_cxx.so.20: cannot open shared object file: No such file or directory```

4

2 回答 2

0

尝试执行以下操作:

cd /home/parikshit/.local/lib/python3.6/site-packages/torch
ls
# You should find a .so file. Run the following command on that file
ldd the_file_you_found.so
#In the output you should see "not found"
#To find out which apt packages provide this .so:
sudo apt install apt-file
sudo apt-file update
#Now search for that "not found" library file. Example:
apt-file search blah.so.100
#In the first part of each line you will see the name of the file that you need to install. Example:
sudo apt install lib-hello
#Enjoy!
于 2020-09-10T09:02:40.580 回答
0
cd /home/parikshit/.local/lib/python3.6/site-packages/torch ls
# You should find a .so file. Run the following command on that file ldd the_file_you_found.so
#In the output you should see "not found"
#To find out which apt packages provide this .so: sudo apt install apt-file sudo apt-file update
#Now search for that "not found" library file. Example: apt-file search blah.so.100
#In the first part of each line you will see the name of the file that you need to install. Example: sudo apt install lib-hello
#Enjoy!

上一个答案解决了我在 Jetson Nano 上找不到 libmpi_cxx.so.20 的问题,但我在导入 Torch 时遇到了不同的错误。

错误是: from torch._C import * ImportError: numpy.core.multiarray failed to import

如果由于导入 numpy 失败而导致导入 torch 时遇到问题,请按照以下步骤操作。

pip install numpy -I

您可以在GitHub 上查看问题以获取详细信息。

于 2020-12-22T13:52:20.783 回答