如何解决OSMNX无法识别任何属性“ AttributeError:模块'osmnx'没有属性”
我已经使用conda config --prepend通道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,Germany"
ox.graph.graph_from_place(place_name,network_type='all_private')
AttributeError: module 'osmnx' has no attribute 'graph'
黄牛环境的python版本是3.8.6和Spyder(4.1.4)。 您能帮我找到这些错误的解决方案吗?
解决方法
您的桌面上有一个名为osmnx.py
的文件,并且正在导入该文件而不是已安装的模块。重命名该文件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。