【问题标题】:Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? error: command 'gcc' failed with exit status 1在库 libxml2 中找不到函数 xmlCheckVersion。是否安装了 libxml2?错误:命令“gcc”失败,退出状态为 1
【发布时间】:2016-03-19 03:10:00
【问题描述】:

我正在部署并使用弹性 beantalk。当我做 eb create 时,我得到你的 requirements.txt 是无效的,当我仔细观察时,我得到了两个错误

  Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
  *********************************************************************************
  error: command 'gcc' failed with exit status 1

我不知道我还能做什么,我试过了 卸载枕头 然后sudo apt-get install libjpeg-dev 安装pillow 返回 和pip install lxml

我试过了

sudo apt-get install libxml2-dev libxslt1-dev python-dev

apt-get install libxml2-dev libxslt1-dev python-dev

我只是想部署我所有的东西,但是这个枕头东西抓住了我的脚踝,你能帮帮我吗

我这里有什么需要吗?

    packages:
      yum:
        git: []
        postgresql93-devel: []
        libjpeg-turbo-devel: []
        libpng-devel: []
        freetype-devel: []


container_commands:
  01_migrate:
    command: "source /opt/python/run/venv/bin/activate && python ebagu/manage.py migrate --noinput"
    leader_only: true
  02_createsu:
    command: "source /opt/python/run/venv/bin/activate && python ebagu/manage.py createsu"
    leader_only: true
  03_collectstatic:
    command: "source /opt/python/run/venv/bin/activate && python ebagu/manage.py collectstatic --noinput"
  04_uninstall_pil:
    command: "source /opt/python/run/venv/bin/activate && yes | pip uninstall Pillow"

  05_reinstall_pil:
    command: "source /opt/python/run/venv/bin/activate && yes | pip install Pillow --no-cache-dir"


option_settings:
  "aws:elasticbeanstalk:application:environment":
    DJANGO_SETTINGS_MODULE: "app.settings"
    "PYTHONPATH": "/opt/python/current/app/app:$PYTHONPATH"
  "aws:elasticbeanstalk:container:python":
    WSGIPath: app/app/wsgi.py
    NumProcesses: 3
    NumThreads: 20
  "aws:elasticbeanstalk:container:python:staticfiles":
    "/static/": "www/static/"

【问题讨论】:

  • 安装 libxml2-dev 为我解决了这个错误。

标签: python django amazon-web-services gcc pillow


【解决方案1】:

Amazon 的弹性 beanstalk 目前不支持 apt-get 包管理器,因此必须使用默认的 yum,如您的配置文件中所示。如果您要使用 ssh 进入服务器,则可以手动安装枕头的依赖项

sudo yum install libxml2-devel libxslt-devel libjpeg-turbo-devel

(还要注意不同的包名称)。或者最好作为配置文件的补充,以便在部署时根据需要安装。

packages:
  yum:
     # Your other non-python packages
    libxml2-devel: []
    libxslt-devel: []
    libjpeg-turbo-devel: []

【讨论】:

    【解决方案2】:

    在 Ubuntu 上试试这个:

       sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev python3-pip
    

    【讨论】:

    • 也适用于 Debian。
    【解决方案3】:

    尝试在使用 Elastic Beanstalk (AMI 2017.03) 部署的 EC2 实例中安装 lxml 时,我遇到了完全相同的错误,就像在原始问题中一样。该问题仅在 Python 3.5 中出现,在 Python 2.7 中我可以毫无问题地安装它。

    就我而言,问题是没有安装 GCC。做sudo yum install gcc 解决了它。

    我认为问题在于 Amazon AMI 存储库不包含用于 libxml2 的 Python 3 绑定的二进制包。 Python 2.6 和 2.7 (python2X-lxml) 的绑定可用,这就是 Python 2 开箱即用的原因。但是在使用 pip-3.5 时,pip 找不到它们,而是尝试从源代码安装它们,此时指出它需要 GCC。

    我的弹性 beanstalk 配置文件的 packages 部分如下所示:

    packages:
        yum:
            gcc: []
            python35: []
            python35-pip: []
            python35-devel: []
            libxml2-devel: []
            libxslt-devel: []
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-20
      • 2011-11-11
      • 1970-01-01
      • 1970-01-01
      • 2012-06-21
      • 2019-12-01
      • 2016-11-01
      相关资源
      最近更新 更多