pip install Cartopy报错

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting cartopy
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f6/55/1e1c737dc9436b320deead73d1c455ddbb74b8b6992081863492f6f6378a/Cartopy-0.20.2.tar.gz (10.8 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'

  error: 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.

采用whl包安装后报错

ImportError: DLL load failed while importing trace: 找不到指定的模块

解决分析

cartopy和依赖包的版本冲突问题

依赖包卸载

pip uninstall cartopy

pip uninstall Pillow

pip uninstall pyshp

pip uninstall Shapely

pip uninstall pyproj

正确包安装

登录https://www.lfd.uci.edu/~gohlke/pythonlibs/,找到对应自己python版本现有最高版本的安装包,例如我的python版本是3.8,平台为64位windows,则选择下载:

Pillow-9.1.1-cp38-cp38-win_amd64.whl
Shapely-1.8.2-cp38-cp38-win_amd64.whl
pyproj-3.3.1-cp38-cp38-win_amd64.whl
pyshp-2.3.0-py2.py3-none-any.whl
Cartopy-0.20.2-cp38-cp38-win_amd64.whl

下载后利用pip进行安装:

pip install Pillow-9.1.1-cp38-cp38-win_amd64.whl
pip install Shapely-1.8.2-cp38-cp38-win_amd64.whl
pip install pyproj-3.3.1-cp38-cp38-win_amd64.whl
pip install pyshp-2.3.0-py2.py3-none-any.whl
pip install Cartopy-0.20.2-cp38-cp38-win_amd64.whl

问题解决

在这里插入图片描述

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐