简体   繁体   English

无法使用Dockerfile安装python模块

[英]Can't install python module with Dockerfile

I am unable to install Flask-User from my requirements file as when it comes to that module I get the error: 我无法从需求文件中安装Flask-User,因为涉及该模块时出现错误:

Collecting bcrypt>=2.0 (from flask-user->-r requirements.txt (line 8))
  Downloading https://files.pythonhosted.org/packages/ce/3a/3d540b9f5ee8d92ce757eebacf167b9deedb8e30aedec69a2a072b2399bb/bcrypt-3.1.6.tar.gz (42kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  Complete output from command /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-vtowffrv/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel "cffi>=1.1; python_implementation != 'PyPy'":
  Collecting setuptools
    Downloading https://files.pythonhosted.org/packages/82/9c/e812a9838feaf76cd9a960ca4ced3be7f2db31e473677a621d006e128db2/setuptools-40.7.3-py2.py3-none-any.whl (574kB)
  Collecting wheel
    Downloading https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl
  Collecting cffi>=1.1
    Downloading https://files.pythonhosted.org/packages/e7/a7/4cd50e57cc6f436f1cc3a7e8fa700ff9b8b4d471620629074913e3735fb2/cffi-1.11.5.tar.gz (438kB)
      Complete output from command python setup.py egg_info:

          No working compiler found, or bogus compiler options passed to
          the compiler from Python's standard "distutils" module.  See
          the error messages above.  Likely, the problem is not related
          to CFFI but generic to the setup.py of any Python package that
          tries to compile C code.  (Hints: on OS/X 10.8, for errors about
          -mno-fused-madd see http://stackoverflow.com/questions/22313407/
          Otherwise, see https://wiki.python.org/moin/CompLangPython or
          the IRC channel #python on irc.freenode.net.)

      ----------------------------------------
  Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-wt1ra3xd/cffi/

  ----------------------------------------
Command "/usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-vtowffrv/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel "cffi>=1.1; python_implementation != 'PyPy'"" failed with error code 1 in None
ERROR: Service 'frontend' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

I have tried to upgrade pip, and install setuptools to no avail. 我试图升级pip,并安装setuptools无济于事。

This is my dockerfile: 这是我的dockerfile:

FROM python:3.6-alpine
WORKDIR /app
COPY requirements.txt /app
COPY app.py /app
COPY templates /app/templates
RUN pip install -r requirements.txt
EXPOSE 5000
ENTRYPOINT ["python"]
CMD ["app.py"]

requirements.txt: requirements.txt:

Flask
requests
jsonify
pymongo
request
wtforms
flask-mongoengine
flask-user

Edit: 编辑:

Appears gcc is not included in the alpine base image. 似乎gcc未包含在高山基础图像中。 I resolved this issue by using FROM python:3.6-slim instead. 我改用FROM python:3.6-slim解决了这个问题。

Appears gcc is not included in the alpine base image. 似乎gcc未包含在高山基础图像中。 I resolved this issue by using FROM python:3.6-slim instead. 我改用FROM python:3.6-slim解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM