在python上配置软件包

2024-05-16 05:31:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我很好奇,这里是否有人能够使用h5py库成功访问NREL的风数据集,如下所述:https://github.com/NREL/hsds-examples

我在配置HSD时遇到问题。我正在使用Python 3.7.10和Anaconda。以下是列出的步骤:

为此,您必须首先安装h5pyd:

pip install --user h5pyd

接下来,您需要配置HSD:

hsconfigure

并在提示下输入:

hs_endpoint = https://developer.nrel.gov/api/hsds
hs_username = None
hs_password = None
hs_api_key = 3K3JQbjZmWctY0xmIfSYvYgtIcM3CN0cb1Y2w9bf

如何配置HSD?当我在终端中输入'hsconfigure'时,我看到一个错误“command not found”。这是因为我使用pip下载而发生的吗

有什么建议吗?我从来没有在Python上配置过任何东西,所以我完全不知道该从哪里开始


Tags: pip数据httpsgithubcomnoneapiexamples
1条回答
网友
1楼 · 发布于 2024-05-16 05:31:44

我能够通过以下设置使其运行:

  1. (可选)MambaForge base。曼巴比康达快,在基地工作实际上是一种反模式

  2. 在专用环境中使用Jupyter

    jupyter.yaml

    name: jupyter
    channels:
      - conda-forge
    dependencies:
      - jupyter
      - nb_conda_kernels
    

    命令

    mamba env create -n jupyter -f jupyter.yaml
    
  3. 专用内核环境中的HSD

    hsds.yaml

    name: hsds
    channels:
      - conda-forge
    dependencies:
      # core requirements
      - python=3.9 
      - ipykernel  # enables use in jupyter
    
      # dependencies and modules used in notebooks
      - h5py
      - pandas
      - scipy
      - pyproj
      - pytz
      - matplotlib
      - seaborn
      - requests
    
      # install h5pyd from PyPA
      - pip
      - pip:
        - h5pyd
    

    命令

    mamba env create -n hsds -f hsds.yaml
    mamba run -n hsds  no-capture-output hsconfigure
    ## follow instructions
    
  4. 克隆repo并在其中启动Jupyter

    git clone https://github.com/NREL/hsds-examples.git
    cd hsds-examples
    conda activate jupyter
    jupyter notebook
    
  5. 导航到笔记本(.ipynb),选择hsds作为内核

相关问题 更多 >