先下载octave:
!apt install octave
若下载时发生错误:
Error: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
某些链接404 NOT FOUND或者获取不到
Error报的信息显示是这个包向source里的资源下载失败了
根据提示,我们首先应当更新一下source
!apt-get update
如果在apt-get update后依然报这个error,那就说明这个source本身就有错误,可以尝试
!apt-get update --fix-missing
如果执行后依旧报这个error,就需要换source
通过上述解决办法安装好了octave,再在colab上运行
!octave -W file.m
这里file.m是当前路径下的文件,最好在执行上述命令时将当前路径设置为想要运行文件的路径
%cd '/content/drive/MyDrive/想要执行的文件所在目录'
例如:
%cd '/content/drive/MyDrive/Bert/Bert-Pytorch-TextClassification'
!pwd
!pwd用于查看当前路径是什么