【问题标题】:Cannot import Owlready library into Python无法将 Owlready 库导入 Python
【发布时间】:2016-09-27 07:54:22
【问题描述】:

我是 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

【问题讨论】:

    标签: python ontology owlready


    【解决方案1】:

    当您使用 Python 2 时,Owlready 似乎适用于 Python 3。请更改您的 Python 版本以使其正常工作。

    无效的语法错误是因为新的 Python 3 参数列表,请参阅:https://docs.python.org/3/tutorial/controlflow.html#arbitrary-argument-lists

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-11
      • 1970-01-01
      • 1970-01-01
      • 2020-11-07
      • 2016-09-18
      • 2018-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多