作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 heroku 上运行网络应用程序。我想使用 TA-Lib。这是python库。在 heroku 上安装时出现错误。
heroku run pip install ta-lib
主要,错误:命令“gcc”失败,退出状态为 1。
Collecting TA-Lib
Using cached TA-Lib-0.4.10.tar.gz
Building wheels for collected packages: TA-Lib
Running setup.py bdist_wheel for TA-Lib ... error
Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ggrhshl_/TA-Lib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpy3tq74cipip-wheel- --python-tag cp36:
/tmp/pip-build-ggrhshl_/TA-Lib/setup.py:77: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib.common' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/app/.heroku/python/include/python3.6m -c talib/common.c -o build/temp.linux-x86_64-3.6/talib/common.o
talib/common.c:242:28: fatal error: ta-lib/ta_defs.h: No such file or directory
#include "ta-lib/ta_defs.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for TA-Lib
Running setup.py clean for TA-Lib
Failed to build TA-Lib
Installing collected packages: TA-Lib
Running setup.py install for TA-Lib ... error
Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ggrhshl_/TA-Lib/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-7lciel7r-record/install-record.txt --single-version-externally-managed --compile:
/tmp/pip-build-ggrhshl_/TA-Lib/setup.py:77: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib.common' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/app/.heroku/python/include/python3.6m -c talib/common.c -o build/temp.linux-x86_64-3.6/talib/common.o
talib/common.c:242:28: fatal error: ta-lib/ta_defs.h: No such file or directory
#include "ta-lib/ta_defs.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ggrhshl_/TA-Lib/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-7lciel7r-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ggrhshl_/TA-Lib/
我在我的 ubuntu 中安装 ta-lib 时避免了。
sudo apt-get install python3-dev
问题是 sudo 命令不能在 heroku 上使用。所以我不知道我必须做什么。如何在 heroku 中安装 ta-lib ??
最佳答案
将此添加到您应用的构建包列表中:https://github.com/numrut/heroku-buildpack-python-talib
它应该放在heroku/python
之后。
并从 requirements.txt
中删除 TA-Lib
(如果它已经存在)。
关于python-3.x - 如何在 heroku 中安装 python 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43453953/
我是一名优秀的程序员,十分优秀!