Docker在映像构建中不接受pyOBDC

时间:2019-11-26 09:51:34

标签: python docker

我正在尝试为我的python应用程序构建q docker映像。但是每次运行Docker构建时,都会出现下一个错误。

Building wheels for collected packages: pyodbc, matplotlib, fpdf, pandas, MarkupSafe
  Building wheel for pyodbc (setup.py): started
  Building wheel for pyodbc (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_00fg6j6/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_00fg6j6/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-gq580il1 --python-tag cp38
       cwd: /tmp/pip-install-_00fg6j6/pyodbc/
  Complete output (14 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'pyodbc' extension
  creating build
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/src
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.27 -I/usr/local/include/python3.8 -c src/buffer.cpp -o build/temp.linux-x86_64-3.8/src/buffer.o -Wno-write-strings
  In file included from src/buffer.cpp:12:
  src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
   #include <sql.h>
            ^~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyodbc

如果我从我的requirements.txt中删除pyODBC,它的构建不会出现问题。 我的requirements.txt包含:

Flask==1.1.1
pyodbc==4.0.27
matplotlib==3.1.1
fpdf==1.7.2
pandas==0.25.1

1 个答案:

答案 0 :(得分:0)

我认为您必须安装:

sudo apt-get install unixodbc unixodbc-dev

在我们的Docker文件中。

相关问题