简体   繁体   English

Dockerfile-python:无法打开文件'/usr/app/client.py':[Errno 2]没有这样的文件或目录

[英]Dockerfile - python: can't open file '/usr/app/client.py': [Errno 2] No such file or directory

I have the following Dockerfile... 我有以下Dockerfile ...

FROM python:2.7.15

RUN mkdir /usr/app
WORKDIR /usr/app
COPY ./app/requirements.txt .
RUN pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.1-cp27-none-linux_x86_64.whl && pip install -r requirements.txt

ADD app/* /

ENV PYTHONUNBUFFERED 1

CMD ["python", "/usr/app/client.py"]

Which will build but will not run because of python file. 它将生成,但由于python文件而无法运行。 I have tried... 我努力了...

client.py

and

./client.py

None of this works. 这些都不起作用。 Am I missing something? 我想念什么吗? The ADD should be adding this file along with other python scripts ADD应该将此文件与其他python脚本一起添加

Assuming that you have downloaded the coding files, make sure that your terminal is in the same directory as the file you want to open. 假设您已经下载了编码文件,请确保您的终端与您要打开的文件位于同一目录中。

eg If code.py is in the folder /Downloads/Python 例如,如果code.py在/ Downloads / Python文件夹中

Then run cd /Downloads/Python to change directory (cd) before you start. 然后在开始之前运行cd / Downloads / Python更改目录(cd)。

Then you should be able to type your command as: 然后,您应该可以将命令键入为:

$: /Downloads/Python> python code.py $:/下载/ Python> python code.py

(or similar, depending on your os) (或类似,取决于您的操作系统)

暂无
暂无

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

相关问题 python:无法打开文件'C:\\usr\\local\\bin\\django-admin.py':[Errno 2]没有这样的文件或目录 - python: can't open file 'C:\\usr\\local\\bin\\django-admin.py': [Errno 2] No such file or directory 无法打开文件 'app.py': [Errno 2] 没有那个文件或目录 - can't open file 'app.py': [Errno 2] No such file or directory python3: 无法打开文件 '/app/manage.py': [Errno 2] 没有那个文件或目录 - python3: can't open file '/app/manage.py': [Errno 2] No such file or directory Dockerfile:无法打开文件'./main.py':[Errno 2]没有这样的文件或目录 - Dockerfile: can't open file './main.py': [Errno 2] No such file or directory 找不到 >python scraper.py - 无法打开文件“scraper.py”:[Errno 2] 没有这样的文件或目录 - Cant find >python scraper.py - can't open file 'scraper.py': [Errno 2] No such file or directory 无法打开文件'file.py':[Errno 2] 没有这样的文件或目录 - Can't open file 'file.py': [Errno 2] No such file or directory 在docker容器上运行flask应用程序:错误:python:无法打开文件'//run.py':[Errno 2]没有这样的文件或目录Docker错误 - having on running flask app on docker container : Error: python: can't open file '//run.py': [Errno 2] No such file or directory Docker Error 无法打开文件 'manage.py': [Errno 2] 没有那个文件或目录 - Can't open file 'manage.py': [Errno 2] No such file or directory 无法打开文件“import.py”:[Errno 2] 没有这样的文件或目录 - can't open file 'import.py' :[Errno 2] No such file or directory 无法打开文件 'main.py': [Errno 2] 没有那个文件或目录 - Can't open file 'main.py': [Errno 2] No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM