使用sqlalchemy插件的rdflib会导致ImportError

时间:2015-10-21 15:38:25

标签: python sqlalchemy rdflib

当尝试执行https://github.com/RDFLib/rdflib-sqlalchemy上给出的演示时,我收到错误消息 档案

"store = plugin.get("SQLAlchemy", Store)(identifier=self.ident)
  File "/usr/local/lib/python3.5/site-packages/rdflib/plugin.py", line 104, in get
    return p.getClass()
  File "/usr/local/lib/python3.5/site-packages/rdflib/plugin.py", line 81, in getClass
    self._class = self.ep.load()
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2355, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.5/site-packages/rdflib_sqlalchemy-0.2.dev0-py3.5.egg/rdflib_sqlalchemy/SQLAlchemy.py", line 6, in <module>
    from . import sqlalchemy
ImportError: cannot import name 'sqlalchemy'

我通过克隆存储库并运行setup.py来安装rdflib-sqlalchemy。 sqlalchemy作为依赖项安装。 有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我遇到过这个问题,它与python 2到3有关,它将SQLAlchemy.py中的导入行更改为使用相对路径的导入行。

请参阅https://github.com/RDFLib/rdflib-sqlalchemy/issues/16