[英]Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
[英]No Such File or directory: requirements.txt
目前正在嘗試運行腳本,但我遇到了缺少的 requirements.txt。
這是.sh文件
#!/bin/bash -e
# Copyright 2019 IBM All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [ -z "$1" ]
then
echo "Usage: ./deployCapability.sh <ACTION NAME>"
exit 1
fi
docker run --rm -v "$PWD:/tmp" ibmfunctions/action-python-v3.7 bash -c "cd /tmp && virtualenv virtualenv && source virtualenv/bin/activate && pip install -r /boxai/requirements.txt"
zip -r $1.zip virtualenv __main__.py ./src/action.py ./src/storage.py config.json ./src/bsk_utils.py ./src/__init__.py
ibmcloud fn action update $1 --kind python:3.7 $1.zip --web true --timeout 600000
date
rm $1.zip
當我運行 .sh 時,我會安裝 setuptools、pip、wheel... 完成。 然后它會吐出一個錯誤。
錯誤:無法打開需求文件:[Errno 2] 沒有這樣的文件或目錄:'requirements.txt'
我在哪里做錯了什么?
更新:我的文件夾的位置在桌面上。 我還將路徑更改為 /boxai/requirements.txt 和 /c/users/admin/desktop/boxai/requirements.txt.... 不走運。
謝謝
很難知道哪些文件在哪里,但是您已經使用-v "$PWD:/tmp"
將一些文件掛載到/tmp
,但是缺少的文件似乎是/boxai/requirements.txt
,它不在/tmp
因此,也許您需要添加-v "$PWD/requirements.txt:/boxai/requirements.txt"
,假設您在運行 shell 腳本的當前目錄中有一個 requirements.txt。
我還將路徑更改為 /boxai/requirements.txt
如果你從某個地方下載了這個腳本,我會將它改回原來的樣子,然后將你的本地目錄重新映射到容器中,以根據它期望文件在容器中的位置,而不是基於你的主機上的路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.