OSMnx 无法在 Juypter Notebook 中打开

sme*_*esn 1 conda jupyter-notebook osmnx

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

\n\n
conda config --prepend channels conda-forge\nconda create -n ox --strict-channel-priority osmnx\n
Run Code Online (Sandbox Code Playgroud)\n\n

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

\n\n

我可以看到该模块已下载,因为在 Anaconda Prompt 中我可以输入conda activate ox并且它可以工作。然而,当我进入我的 jupyter 笔记本并输入

\n\n
import osmnx as ox\n
Run Code Online (Sandbox Code Playgroud)\n\n

我收到以下错误:

\n\n

\xe2\x80\x8b

\n\n
---------------------------------------------------------------------------\nModuleNotFoundError                       Traceback (most recent call last)\n<ipython-input-11-7e05e48535cd> in <module>\n----> 1 import osmnx as ox\n      2 \n      3 \n\nModuleNotFoundError: No module named \'osmnx\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

请告知我能做什么。谢谢

\n

gbo*_*ing 7

在您的终端中,运行:

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
Run Code Online (Sandbox Code Playgroud)

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

也可以看看