2017-05-03 86 views
0

我试图在基于official Python image的Alpine Linux发行版的定制Docker镜像中安装Pylint。我试着用以下Dockerfile:在基于Alpine Linux的Docker镜像中安装pylint

FROM python:3.4-alpine 
RUN apk add --update pylint 

< <这种失败

Step 2/2 : RUN apk add --update pylint 
---> Running in 34949003816d 
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz 
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz 
ERROR: unsatisfiable constraints: 
    pylint (missing): 
    required by: world[pylint] 
The command '/bin/sh -c apk add --update pylint' returned a non-zero code: 1 

此外,我试过

FROM python:3.4-alpine 
RUN pip3 install pylint 

< <这种失败

Step 2/2 : RUN pip3 install pylint 
---> Running in b044e3347d26 
Collecting pylint 
    Downloading pylint-1.7.1-py2.py3-none-any.whl (641kB) 
Collecting mccabe (from pylint) 
    Downloading mccabe-0.6.1-py2.py3-none-any.whl 
Collecting isort>=4.2.5 (from pylint) 
    Downloading isort-4.2.5-py2.py3-none-any.whl (40kB) 
Collecting six (from pylint) 
    Downloading six-1.10.0-py2.py3-none-any.whl 
Collecting astroid>=1.5.1 (from pylint) 
    Downloading astroid-1.5.2-py2.py3-none-any.whl (269kB) 
Collecting wrapt (from astroid>=1.5.1->pylint) 
    Downloading wrapt-1.10.10.tar.gz 
Collecting lazy-object-proxy (from astroid>=1.5.1->pylint) 
    Downloading lazy-object-proxy-1.2.2.tar.gz 
    Complete output from command python setup.py egg_info: 
    running egg_info 
    creating pip-egg-info/lazy_object_proxy.egg-info 
    writing dependency_links to pip-egg-info/lazy_object_proxy.egg-info/dependency_links.txt 
    writing top-level names to pip-egg-info/lazy_object_proxy.egg-info/top_level.txt 
    writing pip-egg-info/lazy_object_proxy.egg-info/PKG-INFO 
    writing manifest file 'pip-egg-info/lazy_object_proxy.egg-info/SOURCES.txt' 
    warning: manifest_maker: standard file '-c' not found 

    reading manifest file 'pip-egg-info/lazy_object_proxy.egg-info/SOURCES.txt' 
    reading manifest template 'MANIFEST.in' 
    error: [Errno 2] No such file or directory: 'examples' 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-1wq1n3ss/lazy-object-proxy/ 
The command '/bin/sh -c pip3 install pylint' returned a non-zero code: 1 

最后,我试图从源代码构建pylint的有以下Dockerfile:

FROM python:3.4-alpine 
RUN apk add --update openssl 
RUN wget https://github.com/PyCQA/pylint/archive/master.zip 
RUN unzip master.zip 
RUN cd pylint-master && python3 setup.py install 

< <这就是现在失败

Step 1/5 : FROM python:3.4-alpine 
---> 9ac5db25a0ca 
Step 2/5 : RUN apk add --update openssl 
---> Using cache 
---> d9f61f983819 
Step 3/5 : RUN wget https://github.com/PyCQA/pylint/archive/master.zip 
---> Using cache 
---> 2a536c150b22 
Step 4/5 : RUN unzip master.zip 
---> Using cache 
---> e160d601a015 
Step 5/5 : RUN cd pylint-master && python3 setup.py install 
---> Running in d2a20f20ff12 

(...) 

Searching for lazy_object_proxy 
Reading https://pypi.python.org/simple/lazy_object_proxy/ 
Downloading https://pypi.python.org/packages/65/63/b6061968b0f3c7c52887456dfccbd07bec2303296911757d8c1cc228afe6/lazy-object-proxy-1.2.2.tar.gz#md5=841b5592bc12c6ef7e48ed1d7a5f9066 
Best match: lazy-object-proxy 1.2.2 
Processing lazy-object-proxy-1.2.2.tar.gz 
Writing /tmp/easy_install-mxtkzpjj/lazy-object-proxy-1.2.2/setup.cfg 
Running lazy-object-proxy-1.2.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-mxtkzpjj/lazy-object-proxy-1.2.2/egg-dist-tmp-f6oeoyxl 
error: Setup script exited with error: [Errno 2] No such file or directory: 'examples' 
The command '/bin/sh -c cd pylint-master && python3 setup.py install' returned a non-zero code: 1 

任何主意,让安装pylint的怎么样?

回答

1

看起来像setuptools的最新版本丢失了。将它添加到Dockerfile后,pip安装pylint的方式工作得很好。

FROM python:3.4-alpine 
RUN pip3 install -U setuptools 
RUN pip3 install -U pylint 
+0

总是当人们制定出自己的解决方案时记得回答他们自己的问题:) – micapam

相关问题