本文介绍了OSMnx不会在Juypter Notebook中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I downloaded osmnx via conda using the code:

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

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

This comes from the osmnx documentation: https://osmnx.readthedocs.io/en/stable/

我可以看到该模块已下载,因为在Anaconda提示中,我可以键入conda activate ox并且它可以工作.但是,当我进入Jupyter笔记本并输入

I can see the module has downloaded because in the Anaconda Prompt I can type conda activate oxand it works. However when I go into my jupyter notebook and type

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'

请告知我该怎么做.谢谢

Please advise as to what I can do. Thanks

推荐答案

在您的终端中,运行:

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 内核,然后启动JupyterLab.

This installs OSMnx and JupyterLab into a conda environment called ox, activates the environment, installs an ipython kernel in the environment, then launches JupyterLab.

另请参见

  • Conda environments not showing up in Jupyter Notebook
  • Conda environments not showing up in Jupyter Notebook
  • How to use Jupyter notebooks in a conda environment?
  • How to add conda environment to jupyter lab
  • Link Conda environment with Jupyter Notebook
  • In which conda environment is Jupyter executing?

这篇关于OSMnx不会在Juypter Notebook中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 04:35