gpt4 book ai didi

python - 错误 libtorch_python.so : cannot open shared object file: No such file or directory

转载 作者:行者123 更新时间:2023-12-04 02:50:01 27 4
gpt4 key购买 nike

我正在尝试实现 fastai 预训练语言模型,它需要 torch 才能工作。运行代码后,我遇到了一些关于导入 torch 的问题。_C

我在我的 linux python 3.7.1 上通过 pip 运行它:torch 1.0.1.post2,cuda V7.5.17。我收到此错误:

Traceback (most recent call last):
File "pretrain_lm.py", line 7, in <module>
import fastai
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/__init__.py", line 1, in <module>
from .basic_train import *
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/basic_train.py", line 2, in <module>
from .torch_core import *
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/torch_core.py", line 2, in <module>
from .imports.torch import *
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/imports/__init__.py", line 2, in <module>
from .torch import *
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/imports/torch.py", line 1, in <module>
import torch, torch.nn.functional as F
File "/home/andira/anaconda3/lib/python3.7/site-packages/torch/__init__.py", line 84, in <module>
from torch._C import *
ImportError: libtorch_python.so: cannot open shared object file: No such file or directory

所以我尝试运行这一行:

from torch._C import *

同样的结果

ImportError: libtorch_python.so: cannot open shared object file: No such file or directory

我检查了/home/andira/anaconda3/lib/python3.7/site-packages/torch/lib,只有libcaffe2_gpu.so libshm.so 文件,我也找不到 libtorch_python.so。我的问题是,libtorch_python.so 实际上是什么?我读过一些文章,其中大部分都在谈论 undefined symbol ,而不是无法打开共享对象文件:没有像我这样的文件或目录。我是 python 和 torch 的新手,所以非常感谢您的回答。

最佳答案

我的问题解决了。我要卸载我的手电筒两次

pip uninstall torch
pip uninstall torch

然后重新安装它:

pip install torch==1.0.1.post2

关于python - 错误 libtorch_python.so : cannot open shared object file: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55476131/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com