如何安装缺失的heroku库? [英] how to install missing heroku libraries?
问题描述
在使用 heroku创建
时发生此错误。我知道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:致命错误:sasl.h:没有这样的文件或目录
remote :#include< sasl.h>
remote:^
remote:编译终止。
remote:error:command'gcc'failed with exit status 1
remote:
remote:--------------------- -------------------
remote:命令/app/.heroku/python/bin/python -cimport setuptools,tokenize; __ file __ ='/ tmp / pip-build-Q1St2s / python-ldap / setup.py'; exec(compile(getattr(tokenize,'open',open)(__ file __)。read().exc('\r\\\
', '\\\
'),__file__,'exec'))install --record /tmp/pip-he61Ck-record/install-record.txt --single-version-external-managed -compile失败,错误代码1 in / tmp / pip-build-Q1St2s / python-ldap
remote:
remote:!推送被拒绝,未能编译Python应用程序
remote:
remote:验证部署....
remote:
remote:!推拒绝屏蔽超越8167。
远程:
到https://git.heroku.com/shielded-beyond-8167.git
! [remote rejected] master - > master(pre-receive hook refused)
错误:未能将一些文件推送到'https://git.heroku.com/shielded-beyond-8167.git'
解决方案看起来你正在尝试将一个Python应用程序部署到Heroku。对于Heroku上的Python应用程序,您需要将您的依赖项列在项目根目录下的
requirements.txt
文件中。
例如,如果您正在运行需要
请求
库的项目,那么您应该定义requirements.txt
包含以下内容的文件请求== 2.7.0
注意:您可以在笔记本电脑(通常)上自动创建一个requirements.txt文件,方法是运行:
$ pip freeze> requirements.txt
这将自动为您创建一个requirements.txt文件,包含您的所有依赖关系= )
如果在创建requirements.txt文件后仍然存在问题,则意味着您可能尝试使用尚未存在的C头文件库安装在Heroku核心图像上 - 在这种情况下,您需要创建自定义buildpack: https:/ /devcenter.heroku.com/articles/buildpacks
While using
heroku create
this error occured. I know that sasl library needs to be installed, but I don't know, how to install it on heroku, I know to install it only on 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'
解决方案It looks like you're trying to deploy a python application to Heroku. For Python applications on Heroku, you need to list your dependencies in a
requirements.txt
file in the root of your project.For instance, if you're running a project that requires the
requests
library, then you'd define arequirements.txt
file that contains the followingrequests==2.7.0
NOTE: You can automatically create a requirements.txt file on your laptop (typically) by running:
$ pip freeze > requirements.txt
This will automatically create a requirements.txt file for you with all of your dependencies included =)
If you're still having issues after creating a requirements.txt file, it means that you're likely trying to use a C header library that hasn't been installed on the Heroku core images -- in this case, you'll need to create a custom buildpack: https://devcenter.heroku.com/articles/buildpacks
这篇关于如何安装缺失的heroku库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!