OSMNX does not recognize any attribute "AttributeError: module 'osmnx' has no attribute"

OSMNX does not recognize any attribute "AttributeError: module 'osmnx' has no attribute"

我已经使用 conda config --prepend channels conda-forge, conda create -n ox --strict-channel-priority osmnx 安装了 osmnx。当我尝试使用 osmnx 模块时,没有一个模块在工作,例如当我使用:

import osmnx as ox
place_name = "Mitte, Hannover, Germany"
ox.graph_from_place(place_name, network_type='drive')

我收到错误消息:

AttributeError: module 'osmnx' has no attribute 'graph_from_place'

当我使用时:

import osmnx as ox
ox.config(use_cache=True, log_console=True)

我收到错误消息:

AttributeError: module 'osmnx' has no attribute 'config'

等等。没有属性有效

我也尝试根据 https://osmnx.readthedocs.io/en/stable/osmnx.html#module-osmnx.graph 使用属性,但它也没有工作,出现同样的错误:

import osmnx as ox
place_name = "Mitte, Hannover, Germany"
ox.graph.graph_from_place(place_name, network_type='all_private')
AttributeError: module 'osmnx' has no attribute 'graph'

ox环境的python版本是3.8.6和Spyder(4.1.4)。 你能帮我找到这些错误的解决方案吗?

您的桌面上有一个名为 osmnx.py 的文件,正在导入该文件而不是已安装的模块。重命名该文件。