我使用 AWS Codebuild 将 Python 代码从 GitHub 存储库上传到 AWS Lambda。所以我用virtualenv.
这是我的buildspec.yml:
version: 0.2
phases:
install:
commands:
- echo "install step"
- apt-get update
- apt-get install zip -y
- apt-get install python3-pip -y
- pip install --upgrade pip
- pip install --upgrade awscli
# Define directories
- export HOME_DIR=`pwd`
- cd $HOME_DIR
- export PREPROCESSING_DIR=$HOME_DIR/preprocessing
- export COMPARE_DIR=$HOME_DIR/compareHilightGood
- export NLTK_DATA=$HOME_DIR/nltk_data
pre_build:
commands:
- echo "pre_build step"
# Configure preprocessing virtual environement
- cd $PREPROCESSING_DIR
- virtualenv venv_preprocessing
- . venv_preprocessing/bin/activate
# Install modules
- pip install -U requests
- pip install -U nltk
# NLTK download
- python -m nltk.downloader -d $NLTK_DATA wordnet stopwords punkt
在这pre_build一步中,我在两个 virtualenv 之间切换。所以,我使用deactivate(或source deactivate)。但在这两种情况下,我都会收到此错误:
[Container] 2019/03/17 09:07:54 Running command source deactivate
/codebuild/output/tmp/script.sh: 4: /codebuild/output/tmp/script.sh: source: not found
[Container] 2019/03/17 09:07:54 Command did not exit successfully source deactivate exit status 127
[Container] 2019/03/17 09:07:54 Phase complete: PRE_BUILD Success: false
[Container] 2019/03/17 09:07:54 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: source deactivate. Reason: exit status 127
不管怎样,似乎命令source并deactivate没有找到。你知道为什么吗 ?
RISEBY
相关分类