Heroku构建包 - 安装Python包使用的可执行文件 [英] Heroku buildpacks - installing executables that are used by Python packages
问题描述
我创建了自定义编译 swig
可执行文件和定制buildpack 。
swig
而失败。 #安装SWIG
if [! -d $ CACHE_DIR / swig];然后
cd $ BUILD_DIR
echo----->获取并安装SWIG 2
curl -O https://s3.amazonaws.com/guybowden/swig.tar。 gz> / dev / null 2>& 1
echo----->正在安装...
tar xzvf swig.tar.gz> / dev / null 2>& amp ; 1
mv swig $ CACHE_DIR / swig
rm swig.tar.gz
echoSWIG installed|缩进
fi
mkdir -p .paybox
cp -R $ CACHE_DIR / swig .paybox
echo更新路径...|缩进
PATH = $ PATH:/app/.paybox/swig/bin/
导出PATH
echo $ PATH | indent
echosetting SWIG_LIB environment var
export SWIG_LIB = / app / .paybox / swig / share / swig / 2.0.5 /
$ b 这发生在任何 pip install
命令运行之前。
如果我 heroku运行bash
,然后手动运行源文件.heroku / venv / bin / activate&& pip install M2Crypto
它没有安装问题,我的应用程序在bash提示符下工作,实现了该实例的生命周期。
我认为有一个问题当初始 pip install -r要求
运行...任何想法时,PATH设置
PATH = $ PATH:$ BUILD_DIR / .paybox / swig / bin /
导出PATH
echo $ PATH |缩进
echo设置SWIG_LIB环境变量
导出SWIG_LIB = $ BUILD_DIR / .paybox / swig / share / swig / 2.0.5 /
$ BUILD_DIR是构建包执行时构建的东西 - not / app /(它是应用程序运行时它的存在位置)
I am trying to install M2Crypto on Heroku. This relies on SWIG being installed.
I've created a custom compiled swig
executable and a custom buildpack.
I then git push
my code up to Heroku, the custom buildpack installs SWIG then tries to install M2Crypto but fails because it can't find swig
.
This is the buildpack customisation:
# Install SWIG
if [ ! -d $CACHE_DIR/swig ]; then
cd $BUILD_DIR
echo "-----> Fetching and installing SWIG 2"
curl -O https://s3.amazonaws.com/guybowden/swig.tar.gz >/dev/null 2>&1
echo "-----> Installing ..."
tar xzvf swig.tar.gz >/dev/null 2>&1
mv swig $CACHE_DIR/swig
rm swig.tar.gz
echo "SWIG installed" | indent
fi
mkdir -p .paybox
cp -R $CACHE_DIR/swig .paybox
echo "updating path..." | indent
PATH=$PATH:/app/.paybox/swig/bin/
export PATH
echo $PATH | indent
echo "setting SWIG_LIB environment var"
export SWIG_LIB=/app/.paybox/swig/share/swig/2.0.5/
This happens before any pip install
commands are run.
If I heroku run bash
and then manually run source .heroku/venv/bin/activate && pip install M2Crypto
it installs no problem and my App works inside the bash prompt for the lifetime of that instance.
I think there's a problem with the PATH setting when the initial pip install -r requirements
runs... any ideas?
And the answer is..
PATH=$PATH:$BUILD_DIR/.paybox/swig/bin/
export PATH
echo $PATH | indent
echo "setting SWIG_LIB environment var"
export SWIG_LIB=$BUILD_DIR/.paybox/swig/share/swig/2.0.5/
$BUILD_DIR is where the stuff is built when the buildpack is executed - not /app/ (which is where it lives when the app runs!
这篇关于Heroku构建包 - 安装Python包使用的可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!