Importing a python module in Jython StreamSets - ImportError: No module named
Importing a python module in Jython StreamSets - ImportError: No module named
我在 docker CentOS 上 运行 StreamSets。尝试在 Jython 中导入 python 包,returns 出现以下错误:
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
注意:由于我是 运行 StreamSets 在 docker 中,我已经确保我的 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 的库来解决此问题。
我在 docker CentOS 上 运行 StreamSets。尝试在 Jython 中导入 python 包,returns 出现以下错误:
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
注意:由于我是 运行 StreamSets 在 docker 中,我已经确保我的 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 的库来解决此问题。