pyodbc 在 IBM Bluemix 服务器上安装错误

pyodbc install on IBM Bluemix server error

我正在尝试在 IBM bluemix 上托管我的应用程序。在我的应用程序中,我使用了 flask 并尝试连接到 Azure SQL 服务器数据库。因此,为此,我正在使用 Pyodbc。

所以在 requirement.txt 文件中我给出了 pip install pyodbcpip install flask。 这些东西正在我的本地机器上安装,应用程序 运行 很好。我正在从数据库中获取结果。

但是当我尝试在 IBM bluemix 上部署我的应用程序时, 在服务器上推送文件时出现错误。 我附上了下面的错误截图。

requirement.txt的内容在这里

unixodbc-dev
pyodbc==3.1.1
Flask==0.12.2

错误消息 error: command 'gcc' failed with exit status 1 让人觉得您可能需要在那台机器上安装 gcc C/C++ 编译器。

The pyodbc docs say:

Windows

On Windows, you will need the appropriate Microsoft Visual C++ compiler. To build Python 2.4 or 2.5 versions, you will need the Visual Studio 2003 .NET compiler. Unfortunately there is no free version of this.

For Python 2.6 and above, you can use the free Visual C++ 2008 Express compiler. (Do not use the 2010 version! You need to use the version that your Python distribution was built with.)

You can create a Windows installer using: python setup.py bdist_wininst

Other

To build on other operating systems, use the gcc compiler.

On Linux, pyodbc is typically built using the unixODBC headers, so you will need unixODBC and its headers installed. On a RedHat/CentOS/Fedora box, this means you would need to install unixODBC-devel:

yum install unixODBC-devel


相关:Unable to install pyodbc on Linux

一种解决方案是使用 miniconda 代替 pip 安装依赖项。将 miniconda 与 buildpack 一起使用已记录在案 here.

有关使用 miniconda 安装 pyodbc 的更多信息,请参阅