我正在通过此代码实验室在 Google Colaboratory 中尝试 tensorflow, 我需要下载'http://download.tensorflow.org/example_images/flower_photos.tgz ' 此文件用于完成实验。
如何下载文件。有没有办法上传 tar 文件而不在我的机器上下载它。
这个方法我试过了
import urllib
testfile = urllib.URLopener()
testfile.retrieve("http://randomsite.com/file.gz", "file.gz")
这不起作用,也找不到 wget。任何人请告诉我如何做到这一点。
最佳答案
可能更简单:使用 !wget
,例如,使用以下命令执行单元格:
!wget https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png
将文件保存到 VM 的本地文件系统。 (注意前导的 !
。这是将此行作为 shell 命令执行的信号。)
关于python - 无论如何,我可以在 Google colaboratory 中下载该文件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49576657/