命令'/ bin / sh -c sudo pip3 install -r requirements.txt'返回一个非零的代码:1

我遇到了构build我的Docker容器的问题。 不完全确定我需要在这里做什么。

Dockerfile

FROM ubuntu:14.04 RUN apt-get update \ && apt-get install -y tar git curl nano wget dialog net-tools build-essential \ && apt-get install --no-install-recommends -y -q python3 python3-pip python3-dev ADD . /bot WORKDIR /bot RUN sudo pip3 install -r requirements.txt CMD ["python3", "app.py"] 

Requirements.txt

 Flask==0.10.1 Jinja2==2.8 MarkupSafe==0.23 Werkzeug==0.11.3 itsdangerous==0.24 lxml==3.5.0 requests==2.9.1 uWSGI==2.0.12 wikiquote==0.1.2 

错误

http://hastebin.com/ipatorezos.coffee

[编辑]这似乎解决它。 添加了其他input。 谢谢!

 FROM ubuntu:14.04 RUN apt-get update \ && apt-get install -y tar git curl nano wget dialog net-tools build-essential \ && apt-get install --no-install-recommends -y -q python3 python3-pip python3-dev \ && apt-get install -y libxml2-dev libxslt-dev python-dev zlib1g-dev ADD . /bot WORKDIR /bot RUN pip3 install -r requirements.txt CMD ["python3", "app.py"] 

错误似乎是:

 Using build configuration of libxslt building 'lxml.etree' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Isrc/lxml/includes -I/usr/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w In file included from src/lxml/lxml.etree.c:323:0: src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory #include "libxml/xmlversion.h" 

从“ 如何在Ubuntu上安装lxml ”,添加到您的Dockerfile中:

 && apt-get install libxml2-dev libxslt-dev python-dev zlib1g-dev 

另外,请确保您的虚拟机有足够的内存 (如果apt-get install失败 )。

OP确认完整的apt-get命令是:

 RUN apt-get update \ && apt-get install -y tar git curl nano wget dialog net-tools build-essential \ && apt-get install --no-install-recommends -y -q python3 python3-pip python3-dev \ && apt-get install -y libxml2-dev libxslt-dev python-dev zlib1g-dev