使用pip安装Cartopy库时,出现报错:Getting requirements to build wheel did not run successfully.

编程入门 行业动态 更新时间:2024-10-17 19:28:30

使用pip安装Cartopy库时,出现<a href=https://www.elefans.com/category/jswz/34/1771188.html style=报错:Getting requirements to build wheel did not run successfully."/>

使用pip安装Cartopy库时,出现报错:Getting requirements to build wheel did not run successfully.

使用pip安装Cartopy库时,出现报错:Getting requirements to build wheel did not run successfully.
Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
setup.py:117: UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or later installed, or installation may fail.
warnings.warn(
Proj 8.0.0 must be installed.

输入:

pip install Cartopy

报错:

D:\app\python\python310\Scripts>pip install Cartopy
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
Collecting CartopyUsing cached Cartopy-0.20.2.tar.gz (10.8 MB)Installing build dependencies ... doneGetting requirements to build wheel ... errorerror: subprocess-exited-with-error× Getting requirements to build wheel did not run successfully.│ exit code: 1╰─> [3 lines of output]setup.py:117: UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or later installed, or installation may fail.warnings.warn(Proj 8.0.0 must be installed.[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)

于是,尝试在:
输入:

pip install Cartopy-0.20.2-pp38-pypy38_pp73-win_amd64.whl

出现成功安装提示:

D:\app\python\python310\Scripts>pip install Cartopy-0.20.2-cp310-cp310-win_amd64.whl
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
Processing d:\app\python\python310\scripts\cartopy-0.20.2-cp310-cp310-win_amd64.whl
Collecting shapely>=1.6.4Downloading Shapely-1.8.1.post1-cp310-cp310-win_amd64.whl (1.3 MB)---------------------------------------- 1.3/1.3 MB 2.2 MB/s eta 0:00:00
Requirement already satisfied: pyshp>=2.1 in d:\app\python\python310\lib\site-packages (from Cartopy==0.20.2) (2.2.0)
Requirement already satisfied: numpy>=1.18 in d:\app\python\python310\lib\site-packages (from Cartopy==0.20.2) (1.22.0)
Requirement already satisfied: matplotlib>=3.1 in d:\app\python\python310\lib\site-packages (from Cartopy==0.20.2) (3.5.1)
Requirement already satisfied: pyproj>=3.0.0 in d:\app\python\python310\lib\site-packages (from Cartopy==0.20.2) (3.3.0)
Requirement already satisfied: kiwisolver>=1.0.1 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (1.3.2)
Requirement already satisfied: cycler>=0.10 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (0.11.0)
Requirement already satisfied: packaging>=20.0 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (21.3)
Requirement already satisfied: pillow>=6.2.0 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (9.0.0)
Requirement already satisfied: python-dateutil>=2.7 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (2.8.2)
Requirement already satisfied: fonttools>=4.22.0 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (4.28.5)
Requirement already satisfied: pyparsing>=2.2.1 in d:\app\python\python310\lib\site-packages (from matplotlib>=3.1->Cartopy==0.20.2) (3.0.6)
Requirement already satisfied: certifi in d:\app\python\python310\lib\site-packages (from pyproj>=3.0.0->Cartopy==0.20.2) (2021.10.8)
Requirement already satisfied: six>=1.5 in d:\app\python\python310\lib\site-packages (from python-dateutil>=2.7->matplotlib>=3.1->Cartopy==0.20.2) (1.16.0)
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
Installing collected packages: shapely, Cartopy
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
Successfully installed Cartopy-0.20.2 shapely-1.8.1.post1
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\app\python\python310\lib\site-packages)

但是,在pycharm中导入cartopy模块时,出错:

ImportError: DLL load failed: 找不到指定的模块。

网上查找资料后,原因应该是cartopy模块的依赖库版本不对。

解决方案

cartopy包的依赖库有:pyproj,Pillow,pyshp,Shapely
需要将这几个库卸载后,使用whl重新安装。

  1. 卸载原有依赖库
pip uninstall Pillowpip uninstall pyshppip uninstall Shapelypip uninstall pyproj

此处下载的是:

Pillow-9.0.1-cp310-cp310-win_amd64.whl
pyproj-3.3.0-cp310-cp310-win_amd64.whl
pyshp-2.2.0-py3-none-any.whl
Shapely-1.8.1.post1-cp310-cp310-win_amd64.whl

3.安装库

pip install --user Shapely-1.8.1.post1-cp310-cp310-win_amd64.whlpip install --user pyproj-3.3.0-cp310-cp310-win_amd64.whlpip install --user pyshp-2.2.0-py3-none-any.whlpip install --user  Pillow-9.0.1-cp310-cp310-win_amd64.whlpip install --user Cartopy-0.20.2-pp38-pypy38_pp73-win_amd64.whl

安装完成后,在pycharm中导入cartopy模块时不再报错,成功。

问题解决。

更多推荐

使用pip安装Cartopy库时,出现报错:Getting requirements to build wheel did not run successful

本文发布于:2024-02-10 21:47:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1677469.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:报错   库时   pip   Cartopy   requirements

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!