我正在尝试实现 fastai pretrain 语言模型,它需要火炬才能工作。运行代码后,我遇到了一些关于导入火炬的问题。_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 实际上是什么?我已经阅读了一些文章,并且像大多数文章一样讨论了未定义的符号,而不是无法打开共享对象文件:没有像我这样的文件或目录。我是 python 和 torch 的新手,所以我非常感谢你的回答。
1 回答
函数式编程
TA贡献1807条经验 获得超9个赞
我的问题解决了。我正在卸载我的手电筒两次
pip uninstall torch pip uninstall torch
然后重新安装它:
pip install torch==1.0.1.post2
添加回答
举报
0/150
提交
取消