簡體   English   中英

無法使用Dockerfile安裝python模塊

[英]Can't install python module with Dockerfile

我無法從需求文件中安裝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

我試圖升級pip,並安裝setuptools無濟於事。

這是我的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:

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

編輯:

似乎gcc未包含在高山基礎圖像中。 我改用FROM python:3.6-slim解決了這個問題。

似乎gcc未包含在高山基礎圖像中。 我改用FROM python:3.6-slim解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM