我使用 AWS Codebuild 将 Python 代码从 GitHub 存储库上传到 AWS Lambda。所以我用virtualenv.这是我的buildspec.yml:version: 0.2phases: 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没有找到。你知道为什么吗 ?
1 回答
RISEBY
TA贡献1856条经验 获得超5个赞
deactivate
不是一个可以source
d的脚本,它是在当前shell环境中创建的一个shell函数. venv/bin/activate
。所以尝试deactivate
不使用source
.
至于关于source
自身的错误,请注意该命令. venv/bin/activate
有效,因此 shell 理解命令.
但不理解source
.
添加回答
举报
0/150
提交
取消