我是Python的初学者。我正在使用owlready开发本体。我在PyCharm IDE上安装了owlready
库,但是在我的python代码中导入owlready
时出现了问题。我在文档中尝试from owlready import *
,但总是给我:
Traceback (most recent call last):
File "C:/Users/siekoo/OneDrive/Development/python/NER/onto_start.py", line 1, in <module>
from owlready import *
File "C:\winpython\python-2.7.10.amd64\lib\site-packages\owlready\__init__.py", line 85
def __init__(self, *Entities, ontology = None):
^
SyntaxError: invalid syntax
答案 0 :(得分:2)
看起来Owlready适用于Python 3而你正在使用Python 2.更改你的python版本以使其工作。
无效的语法错误是因为新的Python 3参数列表,请参阅:https://docs.python.org/3/tutorial/controlflow.html#arbitrary-argument-lists