我在嘗試加載我的docker容器時出現了這個錯誤,特別是在嘗試安裝pyodbc包時。
我已經嘗試了這里的所有修復方法。command 'x86_64-linux-gnu-gcc' failed with exit status 1
但我還是得到了以下錯誤:
#17 14.20 In file included from src/buffer.cpp:12:
#17 14.20 src/pyodbc.h:56:10: fatal error: sql.h: 沒有這樣的檔案或目錄
#17 14.20 56 | #include <sql.h>/span>
#17 14.20 | ^~~~~~~
#17 14.20 編譯終止。
#17 14.20 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1。
我的docker檔案看起來像:
從ubuntu:16.04開始
運行 apt-get update
運行 apt-get 安裝 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
復制 ./requirements.txt /app/requirements.txt
WorkKDIR /app
RUN pip3 install python-snappy
RUN pip3 install -r requirements.txt
復制。/app
ENTRYPOINT [ "python3" ]。
CMD [ "app.py" ]。
uj5u.com熱心網友回復:
在安裝pyodbc之前,你需要apt-get install unixodbc-dev -y,sql.h在那個包里,見下圖:
/# dpkg -L unixodbc-dev | grep sql.h
/usr/include/sql.h
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/314101.html
標籤:
