gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 15:13:12 26 4
gpt4 key购买 nike

我正在 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com