python - 在 python 上配置包
问题描述
我很好奇这里是否有人能够使用 h5py 库成功访问 NREL 的风数据集,如下所述:https ://github.com/NREL/hsds-examples ?
我在配置 HSDS 时遇到问题。我正在使用 Python 3.7.10 和 Anaconda。这些是列出的步骤:
为此,您必须首先安装 h5pyd:
pip install --user h5pyd
接下来,您需要配置 HSDS:
hsconfigure
并在提示符下输入:
hs_endpoint = https://developer.nrel.gov/api/hsds
hs_username = None
hs_password = None
hs_api_key = 3K3JQbjZmWctY0xmIfSYvYgtIcM3CN0cb1Y2w9bf
如何配置 HSDS?当我在终端中输入“hsconfigure”时,我看到一个错误“找不到命令”。这是因为我使用 pip 下载而发生的吗?
有什么建议吗?我从来不需要在 Python 上配置任何东西,所以我很迷茫,不确定从哪里开始。
解决方案
我能够通过以下设置运行它:
(可选)MambaForge 基础。Mamba 比 Conda 快,并且在base中工作实际上是一种反模式。
专用环境中的 Jupyter。
jupyter.yaml
name: jupyter channels: - conda-forge dependencies: - jupyter - nb_conda_kernels
命令
mamba env create -n jupyter -f jupyter.yaml
专用内核环境中的 HSDS。
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
克隆 repo 并在其中启动 Jupyter。
git clone https://github.com/NREL/hsds-examples.git cd hsds-examples conda activate jupyter jupyter notebook
导航到笔记本 (.ipynb),选择hsds作为内核。
推荐阅读
- c# - 在更改列表之前使用 Linq ConvertAll 创建列表的备份
- html - Siri 快捷方式:如何使用“获取 URL 的内容”?GET/POST 方法
- javascript - 创建一个 Javascript 函数,该函数针对给定的输入长度生成一个由字母和数字组成的随机字符 id
- verilog - Verilog:“未指定的 I/O 标准”和“IO 引脚和 BUFG 之间的布线位置不佳”错误
- mysql - 建模社交应用程序:按我关注的用户订购“喜欢”
- cassandra - Cassandra 没有运行
- node.js - 节点js字符串解析器
- django - 在 Django REST Framework 中接受 POST 中的不同字段
- javascript - 在 ReactJs 中使用 history.pushState() 时后退按钮不起作用
- python - PyCharm 中的本地 matplotlib 显示,带有来自 Google Cloud Platform 计算引擎的远程 ssh 解释器