OSMNX 无法识别任何属性“AttributeError: module 'osmnx'

我已经使用 conda config --prependchannels 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)。您能帮我找到这些错误的解决方案吗?


慕神8447489
浏览 65回答 1
1回答

达令说

您的桌面上有一个名为的文件osmnx.py,并且正在导入该文件而不是已安装的模块。重命名该文件。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python