【问题标题】:Import rethinkdb python module in to use in Jython导入 rethinkdb python 模块以在 Jython 中使用
【发布时间】:2015-11-11 12:33:36
【问题描述】:

我正在尝试从我的 java 应用程序连接到 rethink db(具有 python 驱动程序)。 RethinkDB python 安装部分https://www.rethinkdb.com/docs/install-drivers/python/ 没有明确下载 python 模块的地方。因为对我来说,我正在尝试使用 jython 进行连接,但它失败了

代码:

 String s = "import rethinkdb as r\n" +
                "r.connect('localhost', 28015).repl()\n" +
                "r.table('tv_shows').insert({ 'name': 'Star Trek TNG' }).run()";

        PyCode code = python.compile(s);
        python.exec(code);
        System.out.println("Done..");

错误:

线程“main” Traceback 中的异常(最后一次调用): 文件“”,第 1 行,在 ImportError: 没有名为 rethinkdb 的模块

关于我在哪里可以显式获取 rethinkdb 模块以及如何使其可用于我的 Java 应用程序的任何想法? (假设把它放到类路径中)

【问题讨论】:

    标签: python jython rethinkdb rethinkdb-python


    【解决方案1】:

    当前发布的 Python 驱动程序始终在 PyPi 上,您可以直接从以下位置下载:https://pypi.python.org/pypi/rethinkdb

    我不是 Jython 用户,所以我最好将您引向这个关于模块的问题:How can I install various Python libraries in Jython?

    我还应该注意到,最近发布了一个官方 Java 驱动程序:http://rethinkdb.com/blog/official-java-driver/

    【讨论】:

      猜你喜欢
      • 2011-03-16
      • 2021-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多