[英]How to execute windows 'move' command in iPython window?
I have a simple script that I need to move a file from the current path to a new folder at the current path in iPython note book.我有一个简单的脚本,我需要将文件从当前路径移动到 iPython 笔记本中当前路径的新文件夹。
!move current_file_name NEW_FOLDER
current_file_name exists and NEW_FOLDER exists, however, I keep getting an error message current_file_name 存在并且 NEW_FOLDER 存在,但是,我不断收到一条错误消息
"The system cannot find the file specified." “该系统找不到指定的文件。”
When I checked the validity of paths, they are all true.当我检查路径的有效性时,它们都是正确的。 This command works fine at the windows command prompt (without '.' sign).此命令在 windows 命令提示符下工作正常(没有“.”符号)。
My complete code:我的完整代码:
import wget
MODEL_ZOO_NAME_PATH = 'http://download.tensorflow.org/models/object_detection/tf2/20200711/ssd_mobilenet_v2_320x320_coco17_tpu-8.tar.gz'
model_zoo_name = wget.download(MODEL_ZOO_NAME_PATH)
if os.path.exists(model_zoo_name):
print('Modal file name: ',model_zoo_name)
!move model_zoo_name PRETRAINED_MODEL_PATH
!cd {PRETRAINED_MODEL_PATH} && tar -zxvf model_zoo_name
Output: Output:
You're passing the actual model_zoo_name
string value to the shell, not the contents of that variable.您将实际的model_zoo_name
字符串值传递给 shell,而不是该变量的内容。 Use $model_zoo_name
or {model_zoo_name}
to get the contents (the second form supports arbitrary python expressions).使用$model_zoo_name
或{model_zoo_name}
获取内容(第二种形式支持任意 python 表达式)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.