Saving pip installs in google colab

笑着哭i 提交于 2019-12-08 10:25:02

问题


Is there a way to save packages in Google Collab to my Google Drive? This is so I won't have to re-download and re-install packages every time I want to use them.


回答1:


To save your the installed configuration to your Google Drive:

from google.colab import drive
drive.mount('/content/gdrive')
pip freeze --local > /content/gdrive/My\ Drive/colab_installed.txt

To restore:

from google.colab import drive
drive.mount('/content/gdrive')
pip install --upgrade --force-reinstall `cat/content/gdrive/My\ Drive/colab_installed.txt`


来源:https://stackoverflow.com/questions/52582858/saving-pip-installs-in-google-colab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!