python - 在 Jython StreamSets 中导入 python 模块 - ImportError : No module named

标签 python docker jython python-import streamsets

我正在 CentOS 上的 Docker 中运行 StreamSets。尝试在 Jython 中导入 python 包,它返回以下错误:

SCRIPTING_05 - Script error while processing record: javax.script.ScriptException: ImportError: No module named pandas in <script> at line number 

这是 Jython 模块中用于导入我的包的代码:

import sys
sys.path.append('/path_to_my/python2.7/site-packages')
import pandas

注意:由于我在 docker 中运行 StreamSets,因此我已经确保我的 docker 可以访问 /path_to_my/python2.7/site-packages

最佳答案

引用 u/metadaddy ask.streamsets/168

The problem with pandas and other Python packages such as NumPy is that, even if you import the Python modules, you will not be able to use them, since they include C extensions, which cannot be loaded by Jython. There are initiatives such as JyNI that aim to bridge the gap between Jython and C extensions; SDC-7313 tracks inclusion of JyNI with the SDC Jython Evaluator.

所以,我想您必须使用独立于 C 的库来解决这个问题。

关于python - 在 Jython StreamSets 中导入 python 模块 - ImportError : No module named,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44079511/

相关文章:

Python从字符串中删除最后一个字符并返回它

python - 使用pyserial读取多个串行设备时延迟较大

python - 使用多处理修改全局变量

linux - 具有不同内核的 D​​ocker

python - 在主管中使用 docker 环境 -e 变量

image - az acr资料库删除和取消标记命令有什么区别?

使用 jython 的 java 有错误的 python 版本

java - Eclipse 中的 Jython 项目找不到 xml 模块,但在相同的项目中工作

python - Hue 和共享 x 轴不起作用 Seaborn 构面网格

java - Eclipse + Jython : Python module not found using one-to-one object factory