我一直在关注一段Youtube视频,将python libs上传到AWS Lambda。youtuber创建了这个包,其中创建了一个名为“MakeFile”的文件夹,其中包含一个“临时”文件夹和(项目).zip:
install: virtual
build: clean_package copy_python build_package_tmp remove_unused zip
virtual:
@echo "--> Setup and activate virtualenv"
if test ! -d "$(VIRTUAL_ENV)"; then pip install virtualenv;
virtualenv $(VIRTUAL_ENV); fi
@echo ""
clean_package:
rm -rf ./package/*
build_package_tmp:
mkdir -p ./package/tmp/lib
cp -R ./$(PROJECT)/. ./package/tmp/
copy_python:
if test -d $(VIRTUAL_ENV)lib; then \
cp -a $(VIRTUAL)/lib/python2.7/site-packages/. ./package/tmp/;
fi
if test -d $(VIRTUAL_ENV)/lib64; then \
cp -a $(VIRTUAL)/lib/python2.7/site-packages/. ./package/tmp/
fi
remove_unused:
rm -rf ./package/tmp/wheel*
rm -rf ./package/tmp/easy-install*
rm -rf ./package/tmp/setup-tools*
zip:
cd ./package/tmp && zip -r ../$(PROJECT).zip . 我在Linux控制台上得到了这个错误:
$make -f Maketest.mk build
rm -rf ./package/*
if test -d envlib; then \
cp -a /lib/python2.7/site-packages/. ./package/tmp/; thenif test -d env/lib64/python2.7/site-packages/. ./package/tmp/; fi
mkdir -p ./package/tmp/lib
cp -R ./AWS/. ./package/tmp/
cp: cannot stat './AWS/.': No such file or directory
Maketest.mk:21: recipe for target 'build_package_tmp' failed
make: *** [build_package_tmp] Error 1创建"package“,只有一个空的"tmp”。
PS:我是AWS Lambda新手,所以如果有更好的方式使用Linux控制台上传,我将非常感谢:)
发布于 2018-05-22 18:09:35
AWS有一个关于如何将python依赖库文件上传到lambda的更清晰的文档。
希望能有所帮助。
https://stackoverflow.com/questions/50463212
复制相似问题