AWS Lambda not importing LXML

前端 未结 8 1410
傲寒
傲寒 2021-01-02 04:57

I am trying to use the LXML module within AWS Lambda and having no luck. I downloaded LXML using the following command:

pip install lxml -t folder

8条回答
  •  执念已碎
    2021-01-02 05:08

    AWS Lambda use a special version of Linux (as far as I can see).

    Using "pip install a_package -t folder" is the good thing to do usually as it will help to package your dependencies within the archive that will be sent to Lambda, but the libraries, and especially the binary libraries have to be compatible with the version of OS and Python on lambda.

    You could use the xml module included in Python : https://docs.python.org/2/library/xml.etree.elementtree.html

    If you really need lxml, this link gives some tricks on how to compile shared libraries for Lambda : http://www.perrygeo.com/running-python-with-compiled-code-on-aws-lambda.html

提交回复
热议问题