OSMnx 无法在 Jupyter Notebook 中打开

OSMnx wont open in Juypter Notebook

我使用以下代码通过 conda 下载了 osmnx:

conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx

这来自 osmnx 文档:https://osmnx.readthedocs.io/en/stable/

我可以看到模块已下载,因为在 Anaconda 提示符中我可以键入 conda activate ox 它可以正常工作。然而,当我进入我的 jupyter notebook 并输入

import osmnx as ox

我收到以下错误:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-11-7e05e48535cd> in <module>
----> 1 import osmnx as ox
      2 
      3 

ModuleNotFoundError: No module named 'osmnx'

请告知我能做什么。谢谢

在您的终端中,运行:

conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx jupyterlab
conda activate ox
python -m ipykernel install --user --name ox --display-name "Python (ox)"
jupyter lab

这会将 OSMnx 和 JupyterLab 安装到名为 ox 的 conda 环境中,激活环境,在环境中安装 ipython kernel,然后启动 JupyterLab。

另见

  • Conda environments not showing up in Jupyter Notebook
  • Conda environments not showing up in Jupyter Notebook