2016-03-11 35 views
6

Voglio distribuire il mio progetto python nella finestra mobile, ho scritto lxml>=3.5.0 nel requirments.txt poiché il progetto ha bisogno di lxml. Qui è la mia dockfile:Come posso installare lxml nella finestra mobile

FROM gliderlabs/alpine:3.3 
RUN set -x \ 
    && buildDeps='\ 
     python-dev \ 
     py-pip \ 
     build-base \ 
    ' \ 
    && apk --update add python py-lxml $buildDeps \ 
    && rm -rf /var/cache/apk/* \ 
    && mkdir -p /app 
ENV INSTALL_PATH /app 
WORKDIR $INSTALL_PATH 
COPY requirements-docker.txt ./ 
RUN pip install -r requirements.txt 
COPY . . 
RUN apk del --purge $buildDeps 
ENTRYPOINT ["celery", "-A", "tasks", "worker", "-l", "info", "-B"] 

ho ottenuto questo quando schiero a finestra mobile:

********************************************************************************* 
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? 
********************************************************************************* 
error: command 'gcc' failed with exit status 1 
---------------------------------------- 
Rolling back uninstall of lxml 

ho pensato che era perché 'python-dev' e 'python-lxml', poi ho curato la dockfile come questo:

WORKDIR $INSTALL_PATH 
COPY requirements-docker.txt ./ 
RUN apt-get build-dev python-lxml 
RUN pip install -r requirements.txt 

non ha funzionato, e ho avuto un altro errore:

---> Running in 73201a0dcd59 
/bin/sh: apt-get: not found 

Come posso installare lxml correttamente nella finestra mobile? Grazie

+2

Si utilizza Alpine, quindi potrebbe essere 'apk add' ma non' apt-get' – user2915097

+0

@ user2915097 Grazie! L'ho cambiato in 'apk add python-dev py-lxml', ha restituito l'errore:' error: comando 'gcc' fallito con exit status 1'. Non so come installare lxml – thiiiiiking

+0

il nome del pacchetto è corretto https://pkgs.alpinelinux.org/package/main/x86/py-lxml – user2915097

risposta

12

ho aggiunto RUN apk add --update --no-cache g++ gcc libxslt-dev==1.1.29-r0 prima RUN pip install -r requirements.txt e ha funzionato.

+2

Volevo solo aggiungere che la versione di libxslt-dev non è necessaria, puoi fare 'libxslt-dev'. – Kazanz

Problemi correlati