简体   繁体   English

没有这样的文件或目录:requirements.txt

[英]No Such File or directory: requirements.txt

Currently trying to run a script, but I'm getting stuck on a missing requirements.txt.目前正在尝试运行脚本,但我遇到了缺少的 requirements.txt。

Here is the.sh file这是.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

When I run the.sh, I goes through installing setuptools, pip, wheel... done.当我运行 .sh 时,我会安装 setuptools、pip、wheel... 完成。 then it will spit out an error.然后它会吐出一个错误。

Error: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'错误:无法打开需求文件:[Errno 2] 没有这样的文件或目录:'requirements.txt'

Where and what am I doing wrong?我在哪里做错了什么?

UPDATE: the location of my folder is in the desktop.更新:我的文件夹的位置在桌面上。 I also changed the path to /boxai/requirements.txt and /c/users/admin/desktop/boxai/requirements.txt.... No luck.我还将路径更改为 /boxai/requirements.txt 和 /c/users/admin/desktop/boxai/requirements.txt.... 不走运。

Thanks谢谢

It's hard to know what files are where , but you've mounted some files to /tmp with -v "$PWD:/tmp" , but the file that is missing seems to be /boxai/requirements.txt , which is outside of /tmp很难知道哪些文件在哪里,但是您已经使用-v "$PWD:/tmp"将一些文件挂载到/tmp ,但是缺少的文件似乎是/boxai/requirements.txt ,它不在/tmp

So, maybe you need to add -v "$PWD/requirements.txt:/boxai/requirements.txt" , which assumes you have a requirements.txt in the current directory where you run the shell script.因此,也许您需要添加-v "$PWD/requirements.txt:/boxai/requirements.txt" ,假设您在运行 shell 脚本的当前目录中有一个 requirements.txt。

I also changed the path to /boxai/requirements.txt我还将路径更改为 /boxai/requirements.txt

If you've downloaded this script from somewhere, I would change it back to what it was before, then remap your local directories into the container accordingly to where it expects files to be in the container, not based on paths on your host.如果你从某个地方下载了这个脚本,我会将它改回原来的样子,然后将你的本地目录重新映射到容器中,以根据它期望文件在容器中的位置,而不是基于你的主机上的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法打开需求文件:[Errno 2] 没有这样的文件或目录:&#39;requirements.txt&#39; - Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' pip install -r requirements.txt [Errno 2] 没有这样的文件或目录:'requirements.txt' - pip install -r requirements.txt [Errno 2] No such file or directory: 'requirements.txt' IOError:[Errno 2]没有这样的文件或目录:&#39;requirements.txt&#39;(没有名为c的模块) - IOError: [Errno 2] No such file or directory: 'requirements.txt' (no module named c) Python中的Requirements.txt文件 - Requirements.txt file in Python heroku 中的 requirements.txt 文件 - requirements.txt file in heroku 创建 requirements.txt 文件 - Creating a requirements.txt file 错误:无法打开需求文件:[Errno 2] 没有这样的文件或目录:'requirements.txt' 使用 AWS Lambda 和 Python 时 - ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' When using AWS Lambda and Python Django requirements.txt根目录中的FIle - Django requirements.txt FIle in root 使用 requirements.txt 安装本地 wheel 文件 - Install local wheel file with requirements.txt 在Python wheel中包含requirements.txt文件 - Include requirements.txt file in Python wheel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM