嗨,我在我的 pipfile 中添加了一个库 pyodbc,当我运行命令 docker-compose up app-name 并运行 dockerfile config 尝试从 pipfile.lock 安装依赖项时出现错误,我的 python 版本是 3.7.4
this is my dockerfile
FROM python:3.7.2 AS base
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client cron \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /srv/server
COPY ./server/Pipfile ./
COPY ./server/Pipfile.lock ./
RUN pip install pipenv uwsgi && pipenv install --deploy --system
ENV PYTHONPATH=/srv/
ENV PYTHONUNBUFFERED=1
ENV UWSGI_THREADS=3
ENV UWSGI_PROCESSES=4
ENV UWSGI_OFFLOAD_THREADS=1
ENV UWSGI_MODULE=server.wsgi:application
ENTRYPOINT [ "sh", "./scripts/wait-for-postgres.sh", "pgrouting", "bash", "./scripts/init.sh" ]
FROM base as test
RUN pipenv install --deploy --system --dev
COPY ./server/ /srv/server/
COPY ./commonlib/ /srv/commonlib/
RUN pytest --junitxml=/srv/test_results/test-results.xml
FROM base as prod
ARG TAG
COPY --from=test /srv/test_results/test-results.xml /srv/test_results/test-results-${TAG}.xml
COPY --from=test /srv/server/ /srv/server/
COPY --from=test /srv/commonlib/ /srv/commonlib/
错误日志从 Pipfile.lock (10ec1a) 安装依赖项... 无法加载路径:/bin/sh: 1: /root/.local/share/virtualenvs/server-7y4nyRnR/bin/python: 未找到
Output:
Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/server-7y4nyRnR/bin/python: not
found
Output:
Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/server-7y4nyRnR/bin/python: not
found
Output:
An error occurred while installing pyodbc==4.0.30 --
hash=sha256:d4ffeab51dcc03c4c1a9a200f70999ce9b827c91defc4f5740633a6d47d3a206 --
hash=sha256:1b8ed92bd50c6d83dec88153880405434bc261bb013ca02809827bb3ffbb319a --
hash=sha256:3a8212be2e49ff29d71d40a9c1af2cdaa71dcc7246cf80a0f9c7254de47ea4a9 --
hash=sha256:852b5deeeb3366af8b4408efed993501708be45d221881bce60c9aac54be726a --
hash=sha256:d3ad340e0053b6ec4130957efbcecce6de48d68e7e78792ea7588e27ffa629f1 --
hash=sha256:7113daddcf346ff095904c568d1e1019f567da74058b4e69099e23bc98211691 --
hash=sha256:eb9e7a4a5126f2695f307b2a6b0b94cbfccfe7481be2c0d33f5456515328f1cc --
hash=sha256:d9d1469786519c3b545168b45db7c3ece3b493c89d51bb5732d38a2eac6d0863 --
hash=sha256:a1af49a2f4f0abbafdc018d510e31561d3f9472725dc1d49cce3bd2e10e9ec18 --
hash=sha256:8fa4147bf3bff1b66a9b1a0063094ca1686b9319383e711e7c193c2b4728b572 --
hash=sha256:bce7e41c7cfc06ec976245f361221dfdd0f04e804010cf255cbb36985f6c3406 --
hash=sha256:52a42be6561932d74bbcc5b0f54dcdcf2eceae3b03192fc0db64a5020bbca057 --
hash=sha256:2f0079951016729b51babebd6aa8112ecef53e11eea3116036c4ec7105f41514! Will try again.
Installing initially failed dependencies…
[InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/cli/command.py", line 252, in
install
[InstallError]: site_packages=state.site_packages
[InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 2062, in
do_install
[InstallError]: keep_outdated=keep_outdated
[InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 1314, in do_init
[InstallError]: pypi_mirror=pypi_mirror,
[InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 901, in
do_install_dependencies
[InstallError]: retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 796, in
batch_install
[InstallError]: _cleanup_procs(procs, failed_deps_queue, retry=retry)
[InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 703, in
_cleanup_procs
[InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: Collecting pyodbc==4.0.30 (from -r /tmp/pipenv-5ev0o0o6-
requirements/pipenv-lkfeuylt-requirement.txt (line 1))
[pipenv.exceptions.InstallError]: Using cached https://files.pythonhosted.org/packages/81/0d/bb08bb16c97765244791c73e49de9fd4c24bb3ef00313aed82e5640dee5d/pyodbc-4.0.30.tar.gz
[pipenv.exceptions.InstallError]: Building wheels for collected packages: pyodbc
[pipenv.exceptions.InstallError]: Building wheel for pyodbc (setup.py): started
[pipenv.exceptions.InstallError]: Building wheel for pyodbc (setup.py): finished with status
'error'
[pipenv.exceptions.InstallError]: Complete output from command /usr/local/bin/python -u -c "import
setuptools, tokenize;__file__='/tmp/pip-install-so2z9fbr/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-9aubmp2e --python-tag cp37:
[pipenv.exceptions.InstallError]: running bdist_wheel
[pipenv.exceptions.InstallError]: running build
[pipenv.exceptions.InstallError]: running build_ext
[pipenv.exceptions.InstallError]: building 'pyodbc' extension
[pipenv.exceptions.InstallError]: creating build
[pipenv.exceptions.InstallError]: creating build/temp.linux-x86_64-3.7
[pipenv.exceptions.InstallError]: creating build/temp.linux-x86_64-3.7/src
[pipenv.exceptions.InstallError]: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -
fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.30 -I/usr/local/include/python3.7m -c src/buffer.cpp -o
build/temp.linux-x86_64-3.7/src/buffer.o -Wno-write-strings
[pipenv.exceptions.InstallError]: In file included from src/buffer.cpp:12:0:
[pipenv.exceptions.InstallError]: src/pyodbc.h:56:17: fatal error: sql.h: No such file or directory
[pipenv.exceptions.InstallError]: #include <sql.h>
[pipenv.exceptions.InstallError]: ^
[pipenv.exceptions.InstallError]: compilation terminated.
[pipenv.exceptions.InstallError]: error: command 'gcc' failed with exit status 1
[pipenv.exceptions.InstallError]:
[pipenv.exceptions.InstallError]: ----------------------------------------
[pipenv.exceptions.InstallError]: Failed building wheel for pyodbc
[pipenv.exceptions.InstallError]: Running setup.py clean for pyodbc
[pipenv.exceptions.InstallError]: Failed to build pyodbc
[pipenv.exceptions.InstallError]: Installing collected packages: pyodbc
[pipenv.exceptions.InstallError]: Running setup.py install for pyodbc: started
[pipenv.exceptions.InstallError]: Running setup.py install for pyodbc: finished with status
'error'
[pipenv.exceptions.InstallError]: Complete output from command /usr/local/bin/python -u -c
"import setuptools, tokenize;__file__='/tmp/pip-install-so2z9fbr/pyodbc/setup.py';f=getattr(tokenize,
'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__,
'exec'))" install --record /tmp/pip-record-_nkznhvg/install-record.txt --single-version-externally-
managed --compile:
[pipenv.exceptions.InstallError]: running install
[pipenv.exceptions.InstallError]: running build
[pipenv.exceptions.InstallError]: running build_ext
[pipenv.exceptions.InstallError]: building 'pyodbc' extension
[pipenv.exceptions.InstallError]: creating build
[pipenv.exceptions.InstallError]: creating build/temp.linux-x86_64-3.7
[pipenv.exceptions.InstallError]: creating build/temp.linux-x86_64-3.7/src
[pipenv.exceptions.InstallError]: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -
fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.30 -I/usr/local/include/python3.7m -c src/buffer.cpp -o
build/temp.linux-x86_64-3.7/src/buffer.o -Wno-write-strings
[pipenv.exceptions.InstallError]: In file included from src/buffer.cpp:12:0:
[pipenv.exceptions.InstallError]: src/pyodbc.h:56:17: fatal error: sql.h: No such file or
directory
[pipenv.exceptions.InstallError]: #include <sql.h>
[pipenv.exceptions.InstallError]: ^
[pipenv.exceptions.InstallError]: compilation terminated.
[pipenv.exceptions.InstallError]: error: command 'gcc' failed with exit status 1
[pipenv.exceptions.InstallError]:
[pipenv.exceptions.InstallError]: ----------------------------------------
[pipenv.exceptions.InstallError]: Command "/usr/local/bin/python -u -c "import setuptools,
tokenize;__file__='/tmp/pip-install-so2z9fbr/pyodbc/setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))"
install --record /tmp/pip-record-_nkznhvg/install-record.txt --single-version-externally-managed --
compile" failed with error code 1 in /tmp/pip-install-so2z9fbr/pyodbc/
ERROR: Couldn't install package: pyodbc
Package installation failed...