zoukankan      html  css  js  c++  java
  • 连接谷歌gee

    在按照https://www.earthdatascience.org/tutorials/intro-google-earth-engine-python-api/ 这个连接说明的步骤进行操作时,

    1. Download Python
    2. Download pip
    3. Run the below command from a command-line to download/install the Python API client
       pip install google-api-python-client
      
    4. Run the below command from a command-line to ensure you have the proper crypto libraries installed
       python -c "from oauth2client import crypt"
      

      If running this command results in an error message, you will need to download and install the proper crypto libraries. This can be accomplished by running the below command.

       pip install pyCrypto
      
    5. Run the below command from a command-line to download/install the Earth Engine Python library
       pip install earthengine-api
      
    6. Run the below command from a command-line to initialize the API and verify your account
       python -c "import ee; ee.Initialize()"
      

      This will result in an error message due to the fact that Google still needs to verify your account with Earth Engine and it currently does not have the proper credentials. Therefore, run:

       earthengine authenticate
      

      This will open your default web-browser (ensure that you’re currently logged into your Google account) and provide you with a unique key to verify your account. Copy and paste the key into the terminal when prompted for the key.

    运行到这一步一直报下面的错误:

    urllib.error.URLError: <urlopen error [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试 失败。>

    需要找到一个本地能用的,可以连接到谷歌网站的端口地址,使用下面命令行:

    set https_proxy=http://127.0.0.1:8087

    set http_proxy=http://127.0.0.1:8087

    冒号后面是需要设置为你自己端口的号码。

    然后再运行 earthengine authenticate,发现报了另外的错误

    certificate verify failed: unable to get local issuer certificate

    查了一下,发现是什么ssl错误,找到如下地址:

    C:ProgramDataAnaconda3Liburllib 这个里面有个文件 request.py,在里面加入下面两行代码:

    import ssl

    ssl._create_default_https_context = ssl._create_unverified_context

    保存,如果无法保存,可以创建新的,然后替换

    然后重新使用 anoconda prompt,使用管理员权限运行,再运行 earthengine authenticate 行,然后复制密码,运行

    成功运行结果

    To authorize access needed by Earth Engine, open the following URL in a web browser and follow the instructions. If the web browser does not start automatically, please manually browse the URL below.

    https://accounts.google.com/o/oauth2/auth?client_id=517222506229-vsmmajv00ul0bs7p89v5m89qs8eb9359.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fearthengine+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdevstorage.full_control&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&code_challenge=YxF62ON0gm2pDU87m96VJIfQvePORdot9sn6cgB2Sxw&code_challenge_method=S256

    The authorization workflow will generate a code, which you should paste in the box below.
    Enter verification code: 4/1AY0e-g6-47F-UIvQcOAkVaa 5IF9Rch8AOfFZtW2SEbCD6uc

    Successfully saved authorization token.

  • 相关阅读:
    努力努力,我假期要练琴学css
    在遇到困难时我们都会想要是这一切不曾发生该多好,可现实并不以我们的意志为转移,我们所能做的就是去克服...
    寒假学习目标~
    平安夜&&圣诞节
    you are the ont that we would like to trust and ca...
    Happy New Year!PR升3啦!
    呵呵,Merry Christmas & Happy New Year!
    使用Rx Framework实现XAML中的物体拖动
    MVVM绑定多层级数据到TreeView并设置项目展开
    Entity framework中EntityFunctions.CreateDateTime方法的闰年闰月bug
  • 原文地址:https://www.cnblogs.com/arcserver/p/14710239.html
Copyright © 2011-2022 走看看