我尝试运行演示,但无论我尝试什么,RuntimeError: b'no arguments in initialization list'
当我尝试使用时都会得到ox.graph_from_place
。我搜索了多个地方,但没有找到任何答案。我使用的是 Windows 10、python 3.7,我的 OSMNX 版本是 0.9。
研究我遇到的问题OSMnx graph_from_place #251,我不太确定如何“自定义环境以匹配我自己机器上的路径”,如问题页面底部所述,但它提供了安装链接OSMnx 在虚拟环境中。从那里我厌倦了卸载 osmnx 和conda install -c conda-forge osmnx
(工作正常)以及conda config --add channels conda-forge
,我也尝试过conda create --override-channels -c conda-forge -n OSMNX python=3 osmnx
,但这给了我
Collecting package metadata: done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- osmnx -> geopandas -> fiona -> gdal[version='>=2.4.1,<2.5.0a0'] -> libgdal==2.4.1=h47faea2_1 -> m2w64-xz
- osmnx -> geopandas -> fiona -> gdal[version='>=2.4.1,<2.5.0a0'] -> libgdal==2.4.1=h47faea2_1 -> poppler[version='>=0.67.0,<0.68.0a0'] -> glib[version='>=2.58.2,<2.59.0a0'] -> gettext[version='>=0.19.8.1,<1.0a0'] -> libffi[version='>=3.2.1,<3.3.0a0'] -> m2w64-gcc-libs
- osmnx -> geopandas -> mapclassify -> scipy
- osmnx -> geopandas -> pysal -> seaborn -> statsmodels[version='>=0.5.0'] -> patsy[version='>=0.4.0']
Current channels:
- https://conda.anaconda.org/conda-forge/win-64
- https://conda.anaconda.org/conda-forge/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
我该怎么做才能让它工作?任何人都可以进一步扩展创建的 github 问题文档吗?或者这是一个不同的问题?
来自 Demo 的代码和错误的追溯:
import networkx as nx
import osmnx as ox
import requests
import matplotlib.cm as cm
import matplotlib.colors as colors
ox.config(use_cache=True, log_console=True)
ox.__version__
G = ox.graph_from_place('Piedmont, California, USA', network_type='drive')
fig, ax = ox.plot_graph(G)
错误追溯
Traceback (most recent call last):
File "C:\Users\pablo\Documents\2019 Spring\Discreet Math\Project\new Dijstra.py", line 9, in <module>
G = ox.graph_from_place('Piedmont, California, USA', network_type='drive')
File "C:\ProgramData\Anaconda3\lib\site-packages\osmnx\core.py", line 1879, in graph_from_place
custom_filter=custom_filter)
File "C:\ProgramData\Anaconda3\lib\site-packages\osmnx\core.py", line 1743, in graph_from_polygon
polygon_utm, crs_utm = project_geometry(geometry=polygon)
File "C:\ProgramData\Anaconda3\lib\site-packages\osmnx\projection.py", line 53, in project_geometry
gdf_proj = project_gdf(gdf, to_crs=to_crs, to_latlong=to_latlong)
File "C:\ProgramData\Anaconda3\lib\site-packages\osmnx\projection.py", line 119, in project_gdf
projected_gdf = gdf.to_crs(utm_crs)
File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\geodataframe.py", line 443, in to_crs
geom = df.geometry.to_crs(crs=crs, epsg=epsg)
File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\geoseries.py", line 304, in to_crs
proj_in = pyproj.Proj(self.crs, preserve_units=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyproj\__init__.py", line 362, in __new__
return _proj.Proj.__new__(self, projstring)
File "_proj.pyx", line 129, in _proj.Proj.__cinit__
RuntimeError: b'no arguments in initialization list'