简体   繁体   English

“没有名为 dgl 的模块”但该模块有效

[英]"No module named dgl" but the module works

When I type the line below into my PyCharm editor, it says "No module named dgl".当我在 PyCharm 编辑器中键入以下行时,它显示“没有名为 dgl 的模块”。 If I click install, it gives me an error.如果我点击安装,它会给我一个错误。 I use an Anaconda environment with dgl installed for my configuration.我使用为我的配置安装了 dgl 的 Anaconda 环境。 The code calling dlg.DGLGraph() works as it should.调用 dlg.DGLGraph() 的代码正常工作。

import dgl
g = dgl.DGLGraph()

The only real problem that I am having with it (I can live with my code constantly showing me a warning), is that the autocompletion doesn't work on my PyCharm editor我遇到的唯一真正问题(我可以忍受我的代码不断向我显示警告)是自动完成功能在我的 PyCharm 编辑器上不起作用

This problem is that you first install dgl, after this you install pytorch.这个问题是你先安装dgl,然后再安装pytorch。 The correct method for install dgl is that you should first install pytorch, then install dgl.安装dgl的正确方法是先安装pytorch,再安装dgl。 because pytorch is a dependency of dgl.因为 pytorch 是 dgl 的依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM