0

您好,我正在尝试使用 pip install osmnx 和 pip install geopandas 安装 OSMnx 和 GeoPandas(根据此链接:https ://geoffboeing.com/2016/11/osmnx-python-street-networks/ )它说,为了使用OSMnx你必须先安装geopandas和rtree,rtree安装没有问题,但是在尝试安装osmnx时发生了这种情况(实际上我在发现我需要安装geopandas之前尝试安装osmnx,我在这里给出了这个错误为了给你尽可能多的信息)

ERROR: Command errored out with exit status 1:
 command: 'c:\users\hodor\appdata\local\programs\python\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Hodor\\AppData\\Local\\Temp\\pip-install-m1_7rif2\\Shapely\\setup.py'"'"'; __file__='"'"'C:\\Users\\Hodor\\AppData\\Local\\Temp\\pip-install-m1_7rif2\\Shapely\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Hodor\AppData\Local\Temp\pip-install-m1_7rif2\Shapely\pip-egg-info'
     cwd: C:\Users\Hodor\AppData\Local\Temp\pip-install-m1_7rif2\Shapely\
Complete output (9 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Hodor\AppData\Local\Temp\pip-install-m1_7rif2\Shapely\setup.py", line 80, in <module>
    from shapely._buildcfg import geos_version_string, geos_version, \
  File "C:\Users\Hodor\AppData\Local\Temp\pip-install-m1_7rif2\Shapely\shapely\_buildcfg.py", line 200, in <module>
    lgeos = CDLL("geos_c.dll")
  File "c:\users\hodor\appdata\local\programs\python\python37\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Given module was not found
----------------------------------------

错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。

我该怎么办(我不想安装 anaconda,所以如果有办法避免 anaconda 我会很高兴)?

任何帮助表示赞赏,非常感谢

编辑:好的,我尝试了作为我的问题重复提到的问题中解释的步骤,我能够按照这些步骤安装 fiona 但是当我输入 pip install geopandas 时,我收到了这个新错误:

ERROR: Command errored out with exit status 1:
 command: 'c:\users\hodor\appdata\local\programs\python\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Hodor\\AppData\\Local\\Temp\\pip-install-5yg59bp6\\shapely\\setup.py'"'"'; __file__='"'"'C:\\Users\\Hodor\\AppData\\Local\\Temp\\pip-install-5yg59bp6\\shapely\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Hodor\AppData\Local\Temp\pip-install-5yg59bp6\shapely\pip-egg-info'
     cwd: C:\Users\Hodor\AppData\Local\Temp\pip-install-5yg59bp6\shapely\
Complete output (9 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Hodor\AppData\Local\Temp\pip-install-5yg59bp6\shapely\setup.py", line 80, in <module>
    from shapely._buildcfg import geos_version_string, geos_version, \
  File "C:\Users\Hodor\AppData\Local\Temp\pip-install-5yg59bp6\shapely\shapely\_buildcfg.py", line 200, in <module>
    lgeos = CDLL("geos_c.dll")
  File "c:\users\hodor\appdata\local\programs\python\python37\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Uvedený modul nebyl nalezen
----------------------------------------

错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。

编辑 2:即使当我尝试运行简单的 Attempt.py 时 cmd 写了“成功安装 fiona”

import fiona

我收到这条消息:

Traceback (most recent call last):
  File "c:\Users\Hodor\.vscode\extensions\ms-python.python-2019.10.41019\pythonFiles\ptvsd_launcher.py", line 43, in <module>
    main(ptvsdArgs)
  File "c:\Users\Hodor\.vscode\extensions\ms-python.python-2019.10.41019\pythonFiles\lib\python\old_ptvsd\ptvsd\__main__.py", line 432, in main    
    run()
  File "c:\Users\Hodor\.vscode\extensions\ms-python.python-2019.10.41019\pythonFiles\lib\python\old_ptvsd\ptvsd\__main__.py", line 316, in run_file
    runpy.run_path(target, run_name='__main__')
  File "C:\Users\Hodor\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\Hodor\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\Hodor\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\Hodor\Desktop\Untitled-1.py", line 1, in <module>
    import fiona
  File "C:\Users\Hodor\AppData\Local\Programs\Python\Python37\lib\site-packages\fiona\__init__.py", line 87, in <module>
    from fiona.collection import BytesCollection, Collection
  File "C:\Users\Hodor\AppData\Local\Programs\Python\Python37\lib\site-packages\fiona\collection.py", line 9, in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: DLL load failed: Module not found

这也可能有助于解决我的问题

4

1 回答 1

1

使用 pip 安装地理空间依赖项可能真的很困难,这主要是由于 Fiona 以我的经验。如果可以使用 conda,强烈建议按照OSMnx 文档中的安装说明进行操作

如果您在安装时遇到任何问题,请尝试使用 conda-forge 和严格的通道优先级将 OSMnx 安装在一个新的、干净的 conda 环境中:

conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority python=3 osmnx
于 2019-10-28T16:19:34.683 回答