Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
标题说明了一切,如何更改 Torch REPL 中的工作目录?我尝试使用对 os.execute('cd some_dir') 的调用,但这不起作用,如此处所示。
th> pwd() --prints: /home/user/Code th> os.execute('cd ..') --prints: true exit 0 th> pwd() -- prints: /home/user/Code
th> pwd()
th> os.execute('cd ..')
其中 pwd() 是一个调用 os.execute('pwd') 的便利函数。
安装 lfs 包(可能已经安装,如果不是“luarocks install luafilesystem”)
然后,
lfs=require 'lfs' lfs.chdir(newdir)
此外,在 torch REPL 中,您可以执行带有 $ 前缀的 shell 命令示例:
th> $ls