[英]Run python script from Docker
嘗試使用 Bash 從 Docker 運行測試 Python 腳本。 Win10 操作系統。 我在目錄C:/Py/test
中有一個文件print.py
$ cd C:/Py/test
$ docker run --volume $(pwd):/home/${USER} python:3.7 python /home/${USER}/print.py
收到此錯誤: python: can't open file 'C:/Program Files/Git/home/print.py': [Errno 2] No such file or directory
為什么試圖在C:/Program Files/Git/home/
目錄而不是C:\Py\test
目錄中找到此文件?
$ python 'print.py'
正在工作
Git bash 前置其安裝路徑,試試這兩種方法:
使用://home/${USER}/print.py
運行: MSYS_NO_PATHCONV=1 docker 運行...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.