您好,我正在尝试使用pip install osmnx和pip install geopandas安装OSMnx和GeoPandas(根据此链接:https://geoffboeing.com/2016/11/osmnx-python-street-networks/)它说,要使用OSMnx,您必须先安装geopandas和rtree,然后再安装rtree,已安装,没有问题,但是在尝试安装osmnx时发生了这种情况(实际上,在发现我需要安装geopandas之前,我曾尝试安装osmnx,在此给出此错误是为了向您提供尽可能多的信息)< / p>
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
这也可能有助于解决我的问题
答案 0 :(得分:1)
使用pip来安装地理空间依赖项可能真的很困难,这主要是由于Fiona的经验。如果可以使用conda,则强烈建议您遵循OSMnx documentation
中的安装说明如果安装有任何问题,请尝试使用conda-forge和严格的通道优先级在新的干净的conda环境中安装OSMnx:
conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority python=3 osmnx