python - Docker/Linux:“x86_64-linux-gnu-gcc”失败,退出状态为 1
问题描述
尝试加载我的 docker 容器时出现此错误,特别是在尝试安装pyodbc
软件包时。
我在这里尝试了所有修复:命令'x86_64-linux-gnu-gcc'失败,退出状态为1
但我仍然收到以下错误:
#17 14.20 In file included from src/buffer.cpp:12:
#17 14.20 src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
#17 14.20 56 | #include <sql.h>
#17 14.20 | ^~~~~~~
#17 14.20 compilation terminated.
#17 14.20 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
我的 dockerfile 看起来像:
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install python3-dev -y
RUN apt-get install python3-pip -y
RUN apt-get install libssl-dev -y
RUN apt-get install build-essential -y
RUN apt-get install libffi-dev -y
RUN apt-get install libsnappy-dev -y
RUN apt-get install lib32ncurses5-dev -y
RUN apt-get install libpcap-dev -y
RUN apt-get install libpq-dev -y
COPY ./requirements.txt /app/requirements.txt
WORKDIR /app
RUN pip3 install python-snappy
RUN pip3 install -r requirements.txt
COPY . /app
ENTRYPOINT [ "python3" ]
CMD [ "app.py" ]
解决方案
你需要apt-get install unixodbc-dev -y
在安装之前pyodbc
,sql.h
在那个包中,见下:
/# dpkg -L unixodbc-dev | grep sql.h
/usr/include/sql.h
推荐阅读
- javascript - (Javascript) 如何在我的掷骰子游戏页面上显示当前分数?
- reactjs - 缩小 iframe 边距
- swift - 无法将模块“领域”加载为“领域”swift 4 Xcode 10
- bootstrap-modal - React-Bootstrap Modal 移动尺寸有额外的空白
- docker - 从 Docker 容器运行 docker-compose
- javascript - AngularJS 指令在使用 $.get 加载动态内容后编译
- laravel - SQLSTATE[08006] 超时过期
- c# - 使用 netcore 2.2 运行“dotnet Myapp.dll”时覆盖 applicationUrl
- nginx - Nginx 入口 OAuth 注销(Kubernetes)?
- terminology - 解释回归输出:股票指数百分比与基点变化