在服务器上运行torchrun命令报错:
export TORCHRUN="path/to/torchrun";
$TORCHRUN --nproc_per_node 2 -m
/usr/bin/env: ‘python’: No such file or directory
打开torchrun文件发现是这么写的:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
from torch.distributed.run import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
把#!/usr/bin/env python 改成
#!path/to/python 即可