Google Colab-ValueError: Mountpoint must be in a directory that exists

前端 未结 10 884
心在旅途
心在旅途 2021-01-03 01:02

I want to mount google drive on google Colab and I am using this command to mount the drive

from google.colab import drive
drive.mount(\'/content/drive/\')
<         


        
相关标签:
10条回答
  • 2021-01-03 01:28

    If mounting does not work even if absolute path /content/drive was used, then verify that appropriate directories exist,

    !mdkir -p /content/drive

    0 讨论(0)
  • 2021-01-03 01:28

    Simply use:

    from google.colab import drive
    drive.mount("/content/gdrive")
    

    instead of:

    from google.colab import drive
    drive.mount("/content/drive/")
    
    0 讨论(0)
  • 2021-01-03 01:29

    @clarky: the error you got was correct tried to tell you that your usage of drive.mount() is incorrect: the mountpoint argument to drive.mount() must be an empty directory that exists, or the name of a non-existent file/directory in a directory that does exist so that the mountpoint can be created as part of the mount operation. Your usage of a relative path in drive.mount('content/drive/') (i.e. content/drive/) implies that the mount should happen at '/content/content/drive' because the interpreter's default path is /content; note the doubled content path component there, and likely you don't already have a directory named /content/content inside of which a mountpoint named drive could be created. The fix to your notebook code is to instead use drive.mount('/content/drive') - note the leading / making the mountpount path absolute instead of relative.

    0 讨论(0)
  • 2021-01-03 01:30

    In my case, I click the folder icon on the side panel, it will show you Upload, Refresh and Mount Drive.

    1. click on the Mount Drive, the 'drive' folder containing 'My Drive' folder appears
    2. Then run

      from google.colab import drive drive.mount('drive')

    3. Go to this URL in a browser will appear - I sign to one of my account

    4. Enter your authorization code

    Drive

    0 讨论(0)
提交回复
热议问题