[英]How to import 3rd party python libraries for use with glue python shell script
I'm trying to import a 3rd party library (datadog) for use with a glue shell script and I'm running into issues.我正在尝试导入第 3 方库 (datadog) 以与胶水 shell 脚本一起使用,但我遇到了问题。 I've packaged the file as a.egg and given the path to it in the glue job, as instructed here .
我已将文件打包为 a.egg,并按照此处的说明在胶水作业中给出了它的路径。 This ends up throwing an error saying zipimport.ZipImportError: not a Zip file: '/tmp/glue-python-libs/datadog.egg'.
这最终会抛出一个错误,提示 zipimport.ZipImportError: not a Zip file: '/tmp/glue-python-libs/datadog.egg'。 When I try using a zip file instead, it throws ModuleNotFoundError: No module named 'datadog'.
当我尝试改用 zip 文件时,它会抛出 ModuleNotFoundError:没有名为“datadog”的模块。 How do I go about importing the library?
我go关于导入库怎么办?
As shown in the documentation in your link , WHL files are also supported.如链接中的文档所示,还支持 WHL 文件。 It says:
它说:
You might already have one or more Python libraries packaged as an.egg or a.whl file.
您可能已经将一个或多个 Python 库打包为 .egg 或 .whl 文件。
There is a.whl file available for the DataDog python library here: https://pypi.org/project/datadog/#files .这里有一个可用于 DataDog python 库的 .whl 文件: https://pypi.org/project/datadog/#files 。 You might try downloading that file, uploading it to your S3 bucket, and using that as your Python library for your Glue job.
您可以尝试下载该文件,将其上传到您的 S3 存储桶,然后将其用作您的 Glue 作业的 Python 库。 You might be more successful using that than trying to build your own.egg file.
使用它可能比尝试构建自己的 .egg 文件更成功。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.