如何安装缺少的heroku库?

时间:2015-07-03 19:33:19

标签: heroku

使用heroku create时发生此错误。我知道需要安装sasl库,但我不知道,如何在heroku上安装它,我知道只能在localhost上安装它。

remote:            gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.19 -IModules -I/opt/openldap-RE24/include -I/usr/include/sasl -I/usr/include -I/app/.heroku/python/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o
remote:            Modules/LDAPObject.c:18:18: fatal error: sasl.h: No such file or directory
remote:             #include <sasl.h>
remote:                              ^
remote:            compilation terminated.
remote:            error: command 'gcc' failed with exit status 1
remote:            
remote:            ----------------------------------------
remote: Command "/app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-Q1St2s/python-ldap/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-he61Ck-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-Q1St2s/python-ldap
remote: 
remote:  !     Push rejected, failed to compile Python app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected to shielded-beyond-8167.
remote: 
To https://git.heroku.com/shielded-beyond-8167.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shielded-beyond-8167.git'

1 个答案:

答案 0 :(得分:0)

看起来你正在尝试将一个python应用程序部署到Heroku。对于Heroku上的Python应用程序,您需要在项目根目录中的requirements.txt文件中列出依赖项。

例如,如果您正在运行需要requests库的项目,那么您将定义一个包含以下内容的requirements.txt文件

requests==2.7.0

注意:您可以通过运行以下内容自动在笔记本电脑上创建requirements.txt文件:

$ pip freeze > requirements.txt

这将自动为您创建一个requirements.txt文件,其中包含所有依赖项=)

如果在创建requirements.txt文件后仍然遇到问题,则表示您可能尝试使用尚未安装在Heroku核心映像上的C头库 - 在这种情况下,您我需要创建一个自定义的buildpack:DEMO

相关问题