一、首先得确定自己电脑或者服务器环境安装的 python 和 cuda 版本是多少,然后选择对应的dgl进行安装,而不是直接使用下面的代码直接进行安装,否则会报错。
pip install dgl # 这种直接安装方式不妥
DGL backend not selected or invalid. Assuming PyTorch for now.
Setting the default backend to "pytorch". You can change it in the ~/.dgl/config.json file or export the DGLBACKEND environment variable. Valid options are: pytorch, mxnet, tensorflow (all lowercase)
Traceback (most recent call last):
File "test.py", line 5, in <module>
import GCL.losses as L
File "/mnt/sdb/xier21/PyGCL-main/examples/../GCL/__init__.py", line 2, in <module>
import GCL.augmentors
File "/mnt/sdb/xier21/PyGCL-main/examples/../GCL/augmentors/__init__.py", line 3, in <module>
from .rw_sampling import RWSampling
File "/mnt/sdb/xier21/PyGCL-main/examples/../GCL/augmentors/rw_sampling.py", line 2, in <module>
from GCL.augmentors.functional import random_walk_subgraph
File "/mnt/sdb/xier21/PyGCL-main/examples/../GCL/augmentors/functional.py", line 6, in <module>
from GCL.utils import normalize
File "/mnt/sdb/xier21/PyGCL-main/examples/../GCL/utils.py", line 4, in <module>
import dgl
File "/mnt/sdb/xier21/anaconda3/envs/nlp/lib/python3.8/site-packages/dgl/__init__.py", line 14, in <module>
from .backend import backend_name, load_backend # usort: skip
File "/mnt/sdb/xier21/anaconda3/envs/nlp/lib/python3.8/site-packages/dgl/backend/__init__.py", line 122, in <module>
load_backend(get_preferred_backend())
File "/mnt/sdb/xier21/anaconda3/envs/nlp/lib/python3.8/site-packages/dgl/backend/__init__.py", line 57, in load_backend
mod = importlib.import_module(".%s" % mod_name, __name__)
File "/mnt/sdb/xier21/anaconda3/envs/nlp/lib/python3.8/importlib/__init__.py", line 127, in imp