[英]AWS Lambda and X-Ray: (Python) How To Install
TL;DR How do I install AWS X-Ray sdk, because the pip install doesn't seem to get the full package TL;DR 我如何安装 AWS X-Ray sdk,因为 pip 安装似乎没有获得完整的 package
Hello Folks,大家好,
I'm working on trying out AWS X-Ray for my Python lambda.我正在为我的 Python lambda 试用 AWS X-Ray。 I know the library is large, but I wanted to get a POC before putting it into a layer.
我知道图书馆很大,但我想在将它放入图层之前获得一个 POC。 The issue is that when I install it, it doesn't seem to get installed.
问题是当我安装它时,它似乎没有安装。
When I run pip install -r requirements.txt
I see that it installs two packages, aws_xray_sdk
and aws_xray_sdk-2.9.0.dist-info
.当我运行
pip install -r requirements.txt
我看到它安装了两个包aws_xray_sdk
和aws_xray_sdk-2.9.0.dist-info
。 When I look into these packages I see that they are 740 kilobytes altogether (makes me think this is a stub of some sort)当我查看这些包时,我发现它们总共有 740 KB(让我觉得这是某种存根)
When I upload my lambda and test it, I get the following error even though the directories are in my venv:当我上传 lambda 并对其进行测试时,即使目录在我的 venv 中,我也会收到以下错误:
[ERROR] Runtime.ImportModuleError: Unable to import module 'users/main': No module named 'aws_xray_sdk' Traceback (most recent call last):
Any help is greatly appreciated.任何帮助是极大的赞赏。
To install the X-Ray SDK for Python, you simply do pip install aws-xray-sdk
and that should work.要为 Python 安装 X-Ray SDK,您只需执行
pip install aws-xray-sdk
即可。 This is explained in the documentation .这在文档中进行了解释。
If this is not working, there is something else that's wrong with your setup.如果这不起作用,则说明您的设置有其他问题。
The issue was that I was not putting my dependencies in the root of my.zip file as the docs clearly show ='(问题是我没有将我的依赖项放在 my.zip 文件的根目录中,因为文档清楚地显示 ='(
4. Create a deployment package with the installed libraries at the root. 4. 在根目录下创建一个部署 package 并安装库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.