如何使用Google Colab中的需求文件安装python依赖项?
类似于pip install -r requirements.txt
最佳答案
有了上面丹尼尔的提示,我得以解决。
使用“从本地计算机脚本上传文件”,我将我的requirements.txt文件上传到了Google Colab平台。找到脚本here。这是脚本,
from google.colab import files
uploaded = files.upload()
for fn in uploaded.keys():
print('User uploaded file "{name}" with length {length} bytes'.format(
name=fn, length=len(uploaded[fn])))
执行后的输出清楚地表明,它将文件保存为“ requirements.txt”。但是,我在Google云端硬盘中找不到此文件,这对我来说很好。然后,
!pip install -r requirements.txt
工作了!