簡體   English   中英

在 cmd 終端中安裝“geopandas”時出錯

[英]Error when installing 'geopandas' in cmd terminal

我在命令提示符下嘗試使用此命令安裝 geopandas 時遇到了這個問題。 “點安裝geopandas”

這是我收到的錯誤消息。

C:\WINDOWS\system32>pip install geopandas 
Collecting geopandas
Using cached geopandas-0.11.1-py3-none-any.whl (1.0 MB)                                                               
Requirement already satisfied: packaging in 
c:\users\sasika\appdata\roaming\python\python38\site-packages (from geopandas) (21.3)                                                                                                               
Collecting fiona>=1.8                                                                                                     
Using cached Fiona-1.8.21.tar.gz (1.0 MB)                                                                               
Preparing metadata (setup.py) ... error                                                                                 
error: subprocess-exited-with-error                                                                                                                                                                                                             
× python setup.py egg_info did not run successfully.                                                                    
│ exit code: 1                                                                                                          
╰─> [1 lines of output]                                                                                                     
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.                                                                                        
[end of output]                                                                                                                                                                                                                             
note: This error originates from a subprocess, and is likely not a problem with pip.                                  
error: metadata-generation-failed                                                                                                                                                                                                               
× Encountered error while generating package metadata.                                                                  
╰─> See above for output.                                                                                                                                                                                                                       
note: This is an issue with the package mentioned above, not pip.                                                       
hint: See above for details.

非常感謝您!

Pip 適用於一些簡單的安裝任務,例如純 python 安裝。 如果復雜的二進制 deps 讓您失望,那么更復雜的工具將更適合您的需求。

創建/激活一個空的conda環境,然后按照安裝說明進行操作:

$ conda install -c conda-forge geopandas

我首先嘗試了這個命令,但它確實需要一些時間來執行。 $ conda install -c conda-forge geopandas所以,我取消了該命令的批處理作業。

然后,制作了一個 python 環境並激活它

$ python -m venv maps
$ cd maps\scripts
$ activate 
$ cd ..
$ cd ..

然后制作包含這些 python 庫的“requirements.txt”文件。

numpy 
pandas 
shapely 
gdal 
fiona 
pyproj 
six 
rtree 

然后按順序運行這些命令。 'maps' 是 python 環境,在我的例子中。

(maps) $ pip install wheel
(maps) $ pip install pipwin
(maps) $ pipwin install -r requirements.txt
(maps) $ pip install geopandas

這成功了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM