gpt4 book ai didi

python - pygdal 版本配置错误

转载 作者:行者123 更新时间:2023-11-28 21:40:14 25 4
gpt4 key购买 nike

我正在尝试使用 pip 安装 pygdal,但发现版本不匹配(2.2.1 与 2.2.0)。我认为 python 的版本不正确。我正在安装 gdal,但它给了我 1.11 版,所以我从 osgeo4mac 安装了 gdal2,它给了我最新版本 2.2.1,但它与 v2.2.0 不匹配。

pip list | grep GDAL
GDAL (2.2.1)

$ gdal-config --version
2.2.1

$ pip install pygdal
Collecting pygdal
Using cached pygdal-2.2.0.3.tar.gz
Requirement already satisfied: numpy>=1.0.0 in /usr/local/lib/python3.6/site-packages (from pygdal)
Building wheels for collected packages: pygdal
Running setup.py bdist_wheel for pygdal ... error
Complete output from command /usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rc/jqv1jd_s4b73mtzpsgyj7y6w0000gp/T/pip-build-fz5kkddd/pygdal/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/rc/jqv1jd_s4b73mtzpsgyj7y6w0000gp/T/tmp0j5fgt_7pip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.12-x86_64-3.6
creating build/lib.macosx-10.12-x86_64-3.6/osgeo
copying osgeo/__init__.py -> build/lib.macosx-10.12-x86_64-3.6/osgeo
copying osgeo/gdal.py -> build/lib.macosx-10.12-x86_64-3.6/osgeo
copying osgeo/gdal_array.py -> build/lib.macosx-10.12-x86_64-3.6/osgeo
copying osgeo/gdalconst.py -> build/lib.macosx-10.12-x86_64-3.6/osgeo
copying osgeo/gdalnumeric.py -> build/lib.macosx-10.12-x86_64-3.6/osgeo
copying osgeo/gnm.py -> build/lib.macosx-10.12-x86_64-3.6/osgeo
copying osgeo/ogr.py -> build/lib.macosx-10.12-x86_64-3.6/osgeo
copying osgeo/osr.py -> build/lib.macosx-10.12-x86_64-3.6/osgeo
running build_ext
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/rc/jqv1jd_s4b73mtzpsgyj7y6w0000gp/T/pip-build-fz5kkddd/pygdal/setup.py", line 173, in <module>
cmdclass=dict(build_ext=gdal_ext),
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 179, in run
self.run_command('build')
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/private/var/folders/rc/jqv1jd_s4b73mtzpsgyj7y6w0000gp/T/pip-build-fz5kkddd/pygdal/setup.py", line 41, in run
inst_gdal_version, GDAL_VERSION))
__main__.GDALConfigError: Version mismatch 2.2.1 != 2.2.0

最佳答案

根据您的 GDAL 版本安装 pydal如果 gdal-config --version然后给你 2.2.1

pip install pygdal==2.2.1.3

(如果你不想更新 GDAL)

如果您不专注于某个版本:

gdal_version=$(gdal-config --version); echo $gdal_version
pip install pygdal>=${gdal_version}.0,<=${gdal_version}.999
## # for zsh
#pip install pygdal">=${gdal_version}.0,<=${gdal_version}.999"

关于python - pygdal 版本配置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45824274/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com