[英]Run python script from Docker
Trying to run test Python script from Docker using Bash.尝试使用 Bash 从 Docker 运行测试 Python 脚本。 Win10 OS.
Win10 操作系统。 I have a file
print.py
in the directory C:/Py/test
我在目录
C:/Py/test
中有一个文件print.py
$ cd C:/Py/test
$ cd C:/Py/test
$ docker run --volume $(pwd):/home/${USER} python:3.7 python /home/${USER}/print.py
$ docker run --volume $(pwd):/home/${USER} python:3.7 python /home/${USER}/print.py
Got this error: python: can't open file 'C:/Program Files/Git/home/print.py': [Errno 2] No such file or directory
收到此错误:
python: can't open file 'C:/Program Files/Git/home/print.py': [Errno 2] No such file or directory
Why is this file trying to be found in the C:/Program Files/Git/home/
directory instead of C:\Py\test
?为什么试图在
C:/Program Files/Git/home/
目录而不是C:\Py\test
目录中找到此文件?
$ python 'print.py'
is working $ python 'print.py'
正在工作
Git bash prepended its installation path, try these two methods: Git bash 前置其安装路径,试试这两种方法:
Use: //home/${USER}/print.py使用://home/${USER}/print.py
Run with: MSYS_NO_PATHCONV=1 docker run...运行: MSYS_NO_PATHCONV=1 docker 运行...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.