【发布时间】:2021-12-28 16:34:22
【问题描述】:
我遵循这个答案是为了能够使用 Google Console Cloud Run 连接到外部 SQL 服务器。 (https://stackoverflow.com/a/46446438/13342846)
但是,我在部署时收到以下错误
Package unixodbc-bin is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
[91mE: Package 'unixodbc-bin' has no installation candidate
[0m
unable to stream build output: The command '/bin/sh -c apt-get install unixodbc-bin -y' returned a non-zero code: 100
Failed to build the app. Error: unable to stream build output: The command '/bin/sh -c apt-get install unixodbc-bin -y' returned a non-zero code: 100
Docker 文件:
# Python image to use.
FROM python:3.7
# Set the working directory to /app
WORKDIR /app
# copy the requirements file used for dependencies
COPY requirements.txt .
ADD odbcinst.ini /etc/odbcinst.ini
RUN apt-get update
RUN apt-get install -y tdsodbc unixodbc-dev
RUN apt-get install unixodbc-bin -y
RUN apt-get clean -y
#....etc
我还创建了 odbcinst.ini 文件,如下所述:https://stackoverflow.com/a/55282188/13342846
它使用的 Python 图像是 3.7
任何帮助将不胜感激!
【问题讨论】:
-
你认为你为什么需要
unixodbc-bin?对于无头 Docker 容器来说,这是一个奇怪的选择,因为 这个包包含三个图形应用程序,用于 unixODBC,即开放式数据库连接套件。 Ref -
如果您要做的只是让
pyodbc启动并运行,那么您需要做的是:1) 确定python:3.7后面的发行版和版本,以便您可以 2) 关注Install the Microsoft ODBC driver for SQL Server (Linux) 的正确指令,然后是最后 3) Configure development environment for pyodbc Python development。 -
以下用户能够回答这个问题,See Here,并将 unixodbc-bin 列为 PyODBC 的依赖项,由于这是 Google Console Cloud Run,因此没有 ODBC 驱动程序并且仅使用 pip 导入根本行不通
标签: python sql-server google-developers-console