-
在代码块中键入 python 代码,或使用前导感叹号!将代码块更改为 bash 环境以执行 linux 代码。感叹号 (!) 启动一个新的 shell,执行操作,然后终止该 shell,而百分比 (%) 会影响与笔记本相关的进程。
-
使用 google 免费提供的 GPU :代码执行程序-更改运行时类型-硬件加速器选择 GPU -保存。注意:这样做会重新启动会话连接,更换之前要保证重要数据已经保存到 google 硬盘或本地。
-
挂载 google 云端硬盘:
from google.colab import drive # Import a library named google.colab drive.mount('/content/drive', force_remount=True) # mount the content to the directory /content/drive
-
linux相关
!pwd #查看当前的工作路径 %cd 路径 #改变工作目录
相关链接
快速入门程序:Google Colab Tutorial