Python Web应用程序Heroku推送依赖项错误-sql.h:没有这样的文件或目录

时间:2017-12-18 15:20:25

标签: python heroku flask

当我尝试使用依赖项文件requirements.txt推送Updated Flask Web应用程序时,我收到以下消息,这是一个让我困惑的地方。我看到它在本地目录中查找文件并找不到它。我使用的是Windows机器。

    Running setup.py install for pyodbc: started
    remote:            Running setup.py install for pyodbc: finished with status 'error'
    remote:            Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-D6Ujo7/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-hvSYGE-record/install-record.txt --single-version-externally-managed --compile:
    remote:            running install
    remote:            running build
    remote:            running build_ext
    remote:            building 'pyodbc' extension
    remote:            creating build
    remote:            creating build/temp.linux-x86_64-2.7
    remote:            creating build/temp.linux-x86_64-2.7/src
    remote:            gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.16 -DSQL_WCHART_CONVERT=1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/app/.heroku/python/include/python2.7 -c src/textenc.cpp -o build/temp.linux-x86_64-2.7/src/textenc.o -Wno-write-strings
    remote:            cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
    remote:            In file included from src/textenc.cpp:2:0:
    remote:            src/pyodbc.h:56:17: fatal error: sql.h: No such file or directory
    remote:             #include <sql.h>
    remote:                             ^
    remote:            compilation terminated.
    remote:            error: command 'gcc' failed with exit status 1
    remote:
    remote:            ----------------------------------------
    remote:        Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-D6Ujo7/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-hvSYGE-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-D6Ujo7/pyodbc/
    remote:  !     Push rejected, failed to compile Python app.
    remote:
    remote:  !     Push failed
    remote: Verifying deploy...
    remote:
    remote: !       Push rejected to data-robot.
    remote:
    To https://git.heroku.com/data-robot.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/data-robot.git'

1 个答案:

答案 0 :(得分:-1)

在输出的第一行,它告诉你它正在尝试构建pyodbc,这是python围绕odbc的包装器。为此,需要sql.h文件,它定义了一堆函数&amp;通过odbc访问数据库的类型。
该文件不在您的构建路径中,因此它在抱怨。 sql.h通常是windows sdk的一部分,所以检查你是否有这个。 sdk通常在

之下
  

C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v x y \ include

如果您没有安装sdk,可以从Microsoft下载(免费)。