lxml未在AWS Elasticbeanstalk实例上安装 [英] lxml not getting installed on AWS Elasticbeanstalk instance

查看:66
本文介绍了lxml未在AWS Elasticbeanstalk实例上安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代码中使用了 lxml 模块来解析AWS响应.在本地它很棒,但是当我将它部署到AWS Elasticbean实例时,它将对lxml引发错误.我尝试了以下解决方案:

I used lxml module in my code to parse AWS response. Locally it works awesome, but when i deploy this to AWS elasticbean instance, it throws errors against lxml. I tried these solutions:

  1. requirements.txt 中包含了 lxml ,但失败了.

  1. included lxml to requirements.txt and it failed.

我访问了AWS实例n,尝试直接安装它,但失败了.

I accessed AWS instance n tried to install it directly and it failed.

我将以下行放在.ebextensions/02_python.config中.

I put the below line in .ebextensions/02_python.config.

09_lxml: 命令:"wget http://lxml.de/files/lxml-3.3.4.tgz && tar -xzvf lxml-3.3.4.tgz&& cd lxml-3.3.4&&/opt/python/run/venv/bin/python setup.py install"

09_lxml: command: "wget http://lxml.de/files/lxml-3.3.4.tgz && tar -xzvf lxml-3.3.4.tgz && cd lxml-3.3.4 && /opt/python/run/venv/bin/python setup.py install"

leader_only:是

leader_only: true

它在一个实例上一次有效,但在新实例上则无效.请需要您的帮助.

It worked once on an instance, but on a new instance nothing is gonna work. Need your help please.

推荐答案

您可以在.ebextensions文件夹中创建一个其他文件,该文件使用yum安装必要的库.您要使用的密钥"(AWS术语)为packages:

You can create an additional file in your .ebextensions folder that installs the necessary libraries using yum. The "key" (AWS' term) you want to use is packages:

packages:
  yum:
    libxml2: []
    libxml2-devel: []
    libxslt: []
    libxslt-devel: []

这指示部署脚本在首次部署您的应用程序时使用yum安装这些软件包.

This instructs the deploy script to install these packages using yum when your app is first being deployed.

它在处理requirements.txt文件之前运行,因此当指示pip安装lxml时,它应该具有必要的库.

It runs before the requirements.txt file is processed, so when pip is instructed to install lxml it should have the necessary libraries.

请参阅在Linux服务器上定制软件的AWS文档. 了解更多信息.

我相信上面列出的软件包是lxml的唯一要求,但是请仔细阅读lxml的在线文档以了解确定.

I believe the packages listed above are the only requirements for lxml, but read up carefully in lxml's online documentation to be certain.

这篇关于lxml未在AWS Elasticbeanstalk实例上安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆