我想安装osmnx,我pip install osmnx
在cmd中写过,但是返回一个错误:
C:\Users\Horseman.mini>pip install osmnx
Collecting osmnx
Using cached https://files.pythonhosted.org/packages/69/77/98cbee7f94abe2c60013fd8751f2b2d6054d48078c61f9774cff0b341f43/osmnx-0.10-py2.py3-none-any.whl
Requirement already satisfied: numpy>=1.16 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from osmnx) (1.17.4)
Collecting networkx>=2.3
Using cached https://files.pythonhosted.org/packages/41/8f/dd6a8e85946def36e4f2c69c84219af0fa5e832b018c970e92f2ad337e45/networkx-2.4-py3-none-any.whl
Requirement already satisfied: Shapely>=1.6 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from osmnx) (1.6.4.post2)
Requirement already satisfied: requests>=2.21 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from osmnx) (2.22.0)
Requirement already satisfied: pandas>=0.24 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from osmnx) (0.25.3)
Requirement already satisfied: matplotlib>=2.2 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from osmnx) (3.1.2)
Collecting Rtree>=0.8.3
Downloading https://files.pythonhosted.org/packages/36/2f/9dc53cfb8edb32a0fb89e689f89e3b4c1a4455652032386fd2dd034c711a/rtree-0.9.1-0_py37hbf79ddb-cp37-cp37m-win_amd64.whl (3.8MB)
|████████████████████████████████| 3.8MB 595kB/s
Collecting descartes>=1.1
Using cached https://files.pythonhosted.org/packages/e5/b6/1ed2eb03989ae574584664985367ba70cd9cf8b32ee8cad0e8aaeac819f3/descartes-1.1.0-py3-none-any.whl
Collecting geopandas>=0.5
Using cached https://files.pythonhosted.org/packages/5b/0c/e6c99e561b03482220f00443f610ccf4dce9b50f4b1093d735f93c6fc8c6/geopandas-0.6.2-py2.py3-none-any.whl
Requirement already satisfied: decorator>=4.3.0 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from networkx>=2.3->osmnx) (4.4.1)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from requests>=2.21->osmnx) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from requests>=2.21->osmnx) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from requests>=2.21->osmnx) (2019.9.11)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from requests>=2.21->osmnx) (1.25.7)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from pandas>=0.24->osmnx) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from pandas>=0.24->osmnx) (2019.3)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from matplotlib>=2.2->osmnx) (2.4.5)
Requirement already satisfied: cycler>=0.10 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from matplotlib>=2.2->osmnx) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from matplotlib>=2.2->osmnx) (1.1.0)
Collecting fiona
Using cached https://files.pythonhosted.org/packages/9d/f4/0a0ddc6174c4a93679b5f1dd3535e7ef8989828e6d5f86112de681f8c87b/Fiona-1.8.11.tar.gz
ERROR: Command errored out with exit status 1:
command: 'c:\users\horseman.mini\appdata\local\programs\python\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\HORSEM~1.MIN\\AppData\\Local\\Temp\\pip-install-ecd90yd9\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\HORSEM~1.MIN\\AppData\\Local\\Temp\\pip-install-ecd90yd9\\fiona\\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\HORSEM~1.MIN\AppData\Local\Temp\pip-install-ecd90yd9\fiona\pip-egg-info'
cwd: C:\Users\HORSEM~1.MIN\AppData\Local\Temp\pip-install-ecd90yd9\fiona\
Complete output (1 lines):
A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
我使用Windows 10,Python版本:2.7和3.7
我不明白如何成功安装osmnx,应该指定什么以及如何指定?(当我尝试安装geopandas时,必须指定相同的GDAL API版本问题)。谢谢您的帮助!
编辑1:我可以在安装后自由导入gdal,但是在我这样做之后:
setx PATH "%PATH%;C:\Program Files (x86)\GDAL"
setx PATH "%GDAL_DATA%;C:\Program Files (x86)\GDAL\gdal-data"
setx PATH "%GDAL_DRIVER_PATH%;C:\Program Files (x86)\GDAL\gdalplugins"
我不能再在cmd中使用pip和python命令,所以不能pip install osmnx
!如果我不设置所有这些内容,它将返回与开始时相同的错误。
编辑2:我在python安装程序中使用过修复,它在cmd中还给了我pip和python命令。安装完gdal后,它的导入效果很好,但是在pip install osmnx
返回我之后,出现了相同的错误
ERROR: Command errored out with exit status 1:
command: 'c:\users\horseman.mini\appdata\local\programs\python\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\HORSEM~1.MIN\\AppData\\Local\\Temp\\pip-install-iqd4diwx\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\HORSEM~1.MIN\\AppData\\Local\\Temp\\pip-install-iqd4diwx\\fiona\\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\HORSEM~1.MIN\AppData\Local\Temp\pip-install-iqd4diwx\fiona\pip-egg-info'
cwd: C:\Users\HORSEM~1.MIN\AppData\Local\Temp\pip-install-iqd4diwx\fiona\
Complete output (1 lines):
A GDAL API version must be specified. Provide a path to gdal-config using a
GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
据我了解,我安装了gdal,但尚未指定gdal版本。我尚未完成或做错了什么?我找到了一些信息,也许会有所帮助
您必须安装并设置GDAL的环境变量,除了在问题中提到的那些GDAL_VERSION
变量之外,还必须添加具有已安装版本的环境变量,您可以通过gdalinfo --version
在cmd中运行来检查它是哪个。在我的情况下,环境变量的值为GDAL_VERSION=2.2.4
,它可能会根据您安装的版本而变化。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句