Traceback (most recent call last):
File "main.py", line 1, in <module>
from trainer import Trainer
File "/home/visionx/mt/qg/paragraph_nqg_max_point_gated/trainer.py", line 10, in <module>
from model import Seq2seq
File "/home/visionx/mt/qg/paragraph_nqg_max_point_gated/model.py", line 6, in <module>
from torch_scatter import scatter_max
File "/home/visionx/miniconda3/envs/qg/lib/python3.7/site-packages/torch_scatter/__init__.py", line 16, in <module>
torch.ops.load_library(spec.origin)
File "/home/visionx/miniconda3/envs/qg/lib/python3.7/site-packages/torch/_ops.py", line 573, in load_library
ctypes.CDLL(path)
File "/home/visionx/miniconda3/envs/qg/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
首先检查有没有安装这个库
sudo find / -name "libpython*so*"
如果没有安装,需要先安装这个 sudo apt-get install libpython3.7
之前一直报错,解决不了,在查找大量的资料后,发现两种解决方法
方法一(临时解决方法)
每次运行都需要运行一次
export LD_LIBRARY_PATH=/home/visionx/miniconda3/envs/qg/lib
其中visionx是自己用户的名字
miniconda3是自己安装anaconda3
qg是自己虚拟环境的名字
方法二 永久解决方法
cd /usr/lib/x86_64-linux-gnu
sudo cp libpython3.10.so.1.0 libpython3.7m.so.1.0
需要输入密码才能解决
标签:OSError,File,python,py,报错,qg,visionx,home,line From: https://www.cnblogs.com/mingtaozhou/p/17258818.html