首页 > 解决方案 > 成功安装OWLready2,但使用时出错

问题描述

正如标题中提到的,我已经将“Python”“pip”更新 到了他们的最新版本,也成功安装“owlready2”库,但是在下面的代码中使用它时:

 from owlready2 import *
 onto_path.append("path to onto in my local windows system- not linux")
 onto= get_ontology("nif.owl")
 onto.load()

Python给了我以下错误:

Blockquote ModuleNotFoundError: 没有名为 owlready2 的模块

标签: pythonowlready

解决方案


重新启动内核(python),它适用于 jupyter notebook Anaconda3

jupyter笔记本中的owlready2

in:
from owlready2 import *
onto = get_ontology("swo-inferred.owl").load()
onto.classes()

out:
<generator object _GraphManager.classes at 0x0000020371A9A848>

推荐阅读