我使用Google Colab来计算我的Kaggle竞赛,现在我决定看看在Google Cloud上使用服务是否会更快。我从Google Cloud下载了一个*.ipybn文件,并尝试将其上传到Google Cloud实例。
我使用这个链接在Google Colab上创建了所有的连接:https://towardsdatascience.com/setting-up-kaggle-in-google-colab-ebb281b61463,它工作得很好。
使用本教程:https://towardsdatascience.com/how-to-use-jupyter-on-a-google-cloud-vm-5ba1b473f4c2,我为Jupyter notebook启动了一个新实例。上传了一个*ipybn文件,我尝试安装Kaggle并运行我的笔记本,但我通常会遇到以下错误:
kaggle: command not found error ensure that your python binaries are on your path
如何将所有内容设置为在Google Cloud服务上工作?
发布于 2019-06-17 15:24:59
下面是关于将根目录路径从content更改为/home/jupyter/的第一个教程,例如:
import zipfile
zip_ref = zipfile.ZipFile("/home/jupyter/Airbus_competition/input/test_v2.zip", 'r')
zip_ref.extractall("/home/jupyter/Airbus_competition/input/test_v2")
zip_ref.close()对于安装kaggle的问题,您没有从Jupyter notebook访问根文件夹的权限,但是当您将命令从!kaggle更改为!~/.local/bin/kaggle时,您可以安装和使用Kaggle API,例如(教程中的命令更改为在GCS上工作):
!mkdir ~/.kaggle
import json
token = {"your_TOKEN"}
with open('/home/jupyter/.kaggle/kaggle.json', 'w') as file:
json.dump(token, file)!cp /home/jupyter/.kaggle/kaggle.json
~/.kaggle/kaggle.json
!~/.local/bin/kaggle config set -n path -v{home/jupyter/Airbus_competition}
!chmod 600 /home/jupyter/.kaggle/kaggle.json
!~/.local/bin/kaggle competitions download -c airbus-ship-detection -p /home/jupyter/Airbus_competition/input --forcehttps://stackoverflow.com/questions/56626560
复制相似问题