您好,我正在为Python构建一个简单的Docker映像,并且我正在努力寻找Requirements.txt中软件包的正确顺序。
它在执行中途失败,因为它碰到了Dockerfile中的beow行
RUN pip install -r requirements.txt
我将输出作为错误放在下面。
任何人都知道如何找出答案?
Dockerfile
FROM python:3.7-buster
ENV accEPT_EULA=Y
COPY . /app
WORKDIR /app
# microsoft SQL Server Prerequisites (installing ODBC Drivervin Linux))
RUN apt-get update \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list \
> /etc/apt/sources.list.d/mssql-release.list \
&& apt-get install -y --no-install-recommends \
locales \
apt-transport-https \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen \
&& apt-get update \
&& apt-get -y --no-install-recommends install \
unixodbc-dev \
msodbcsql17
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
EXPOSE 5000
requirements.txt
flask==1.1.1
SQLAlchemy==1.1.15
pyodbc==4.0.21
simplejson==3.13.2
matplotlib==2.1.0
scikit-learn==0.20.2
surprise==0.1
scikit-learn==0.20.2
O365==1.1.5
pandas==0.23.4
numpy==1.14.0
scipy==1.0.0
错误
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-mubf1uaz/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mubf1uaz/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-v2ateps5 --python-tag cp37
cwd: /tmp/pip-install-mubf1uaz/pyodbc/
Complete output (55 lines):
running bdist_wheel
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.21 -I/usr/local/include/python3.7m -c src/buffer.cpp -o build/temp.linux-x86_64-3.7/src/buffer.o -Wno-write-strings
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.21 -I/usr/local/include/python3.7m -c src/errors.cpp -o build/temp.linux-x86_64-3.7/src/errors.o -Wno-write-strings
src/errors.cpp: In function ‘PyObject* GetErrorFromHandle(Connection*,const char*,HDBC,HSTMT)’:
src/errors.cpp:332:44: warning: ‘Py_ssize_t PyUnicode_GetSize(PyObject*)’ is deprecated [-Wdeprecated-declarations]
if (!msg || PyUnicode_GetSize(msg.Get()) == 0)
^
In file included from /usr/local/include/python3.7m/Python.h:99,from src/pyodbc.h:45,from src/errors.cpp:2:
/usr/local/include/python3.7m/unicodeobject.h:793:24: note: declared here
PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
^~~~~~~~~~~~~~~~~
src/errors.cpp:332:44: warning: ‘Py_ssize_t PyUnicode_GetSize(PyObject*)’ is deprecated [-Wdeprecated-declarations]
if (!msg || PyUnicode_GetSize(msg.Get()) == 0)
^
In file included from /usr/local/include/python3.7m/Python.h:99,from src/errors.cpp:2:
/usr/local/include/python3.7m/unicodeobject.h:793:24: note: declared here
PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
^~~~~~~~~~~~~~~~~
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.21 -I/usr/local/include/python3.7m -c src/cnxninfo.cpp -o build/temp.linux-x86_64-3.7/src/cnxninfo.o -Wno-write-strings
src/cnxninfo.cpp: In function ‘PyObject* GetHash(PyObject*)’:
src/cnxninfo.cpp:45:88: warning: ‘PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE*,Py_ssize_t,const char*)’ is deprecated [-Wdeprecated-declarations]
Object bytes(PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(p),PyUnicode_GET_SIZE(p),0));
^
In file included from /usr/local/include/python3.7m/Python.h:99,from src/cnxninfo.cpp:7:
/usr/local/include/python3.7m/unicodeobject.h:1320:23: note: declared here
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
^~~~~~~~~~~~~~~~~~~~
src/cnxninfo.cpp:45:88: warning: ‘PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE*,from src/cnxninfo.cpp:7:
/usr/local/include/python3.7m/unicodeobject.h:1320:23: note: declared here
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
^~~~~~~~~~~~~~~~~~~~
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.21 -I/usr/local/include/python3.7m -c src/pyodbcdbg.cpp -o build/temp.linux-x86_64-3.7/src/pyodbcdbg.o -Wno-write-strings
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.21 -I/usr/local/include/python3.7m -c src/getdata.cpp -o build/temp.linux-x86_64-3.7/src/getdata.o -Wno-write-strings
src/getdata.cpp: In function ‘PyObject* GetDataDecimal(Cursor*,Py_ssize_t)’:
src/getdata.cpp:405:38: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
pch = PyUnicode_AsUTF8AndSize(result,&cch);
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyodbc
Running setup.py clean for pyodbc