Colab ##### * 官网: https://colab.research.google.com/ .. figure:: https://img.zhaoweiguo.com/uPic/2023/07/BwtXzm.jpg 在 Colab 里使用 GPU 安装路径都设置到 mount的google drive里 ====================================== 1. Mount Google Drive:: from google.colab import drive drive.mount('/content/gdrive') import os, sys nb_path = '/content/notebooks' os.symlink('/content/gdrive/My Drive/Colab Notebooks', nb_path) sys.path.insert(0, nb_path) # or append(nb_path) 2. Install the module in the notebook folder permanently:: !pip install --target=$nb_path spacy 3. 【Usage】Mount your Google drive:: from google.colab import drive drive.mount('/content/gdrive') import sys sys.path.append('/content/gdrive/My Drive/Colab Notebooks') 参考 ==== * 把安装路径都设置到 mount的google drive里,这样以后每次都只需要配置一下路径,不需要再重新安装pip包了: https://ayoolafelix.hashnode.dev/how-to-permanently-install-a-module-on-google-colab-ckixqrvs40su044s187y274tc