简体   繁体   English

OSError: dlopen(libgdal.so, 6): image not found - macOSX High Sierra 中的 GDAL 安装路径问题

[英]OSError: dlopen(libgdal.so, 6): image not found - GDAL install path issue in macOSX High Sierra

Had GDAL installed and working on my machine (macOS running 10.13.6) for a Django project running python 3.6.5.已为运行 python 3.6.5 的 Django 项目在我的机器(运行 10.13.6 的 macOS)上安装并运行 GDAL。 Didn't have any issues for 2+ years and haven't changed anything (to my knowledge), but now running into an issue when I try to execute a manage.py command where it will err out with OSError: dlopen(libgdal.so, 6): image not found 2 年多来没有任何问题,也没有改变任何东西(据我所知),但现在当我尝试执行manage.py命令时遇到问题,它会因OSError: dlopen(libgdal.so, 6): image not found

Trace:痕迹:

Traceback (most recent call last):
  File "manage.py", line 19, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/auth/models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
    class AbstractBaseUser(models.Model):
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/db/models/base.py", line 124, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/db/models/base.py", line 325, in add_to_class
    value.contribute_to_class(cls, name)
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/db/models/options.py", line 214, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/db/__init__.py", line 33, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/db/utils.py", line 211, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/db/utils.py", line 115, in load_backend
    return import_module('%s.base' % backend_name)
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 6, in <module>
    from .features import DatabaseFeatures
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/db/backends/postgis/features.py", line 1, in <module>
    from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/db/backends/base/features.py", line 4, in <module>
    from django.contrib.gis.db.models import aggregates
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/db/models/__init__.py", line 3, in <module>
    from django.contrib.gis.db.models.aggregates import *  # NOQA
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/db/models/aggregates.py", line 1, in <module>
    from django.contrib.gis.db.models.fields import ExtentField
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/db/models/fields.py", line 3, in <module>
    from django.contrib.gis import forms, gdal
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/forms/__init__.py", line 3, in <module>
    from .fields import (  # NOQA
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/forms/fields.py", line 4, in <module>
    from django.contrib.gis.geos import GEOSException, GEOSGeometry
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/geos/__init__.py", line 5, in <module>
    from .collections import (  # NOQA
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/geos/collections.py", line 11, in <module>
    from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/geos/geometry.py", line 11, in <module>
    from django.contrib.gis import gdal
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/gdal/__init__.py", line 28, in <module>
    from django.contrib.gis.gdal.datasource import DataSource
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/gdal/datasource.py", line 39, in <module>
    from django.contrib.gis.gdal.driver import Driver
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
    from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
    from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.py", line 49, in <module>
    lgdal = CDLL(lib_path)
  File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libgdal.so, 6): image not found

I'd previously set GDAL_LIBRARY_PATH='/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.py' which, again, worked for several years until it didn't (or doesn't), and I can confirm libgdal.py is there on that path.我之前设置GDAL_LIBRARY_PATH='/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.py'再次适用于几年直到它没有(或没有),我可以确认 libgdal.py 在那条路上。 The file does exist:该文件确实存在:

在此处输入图像描述

is there something I could potentially modify in /python3.6/ctypes/__init__.py ?我可以在/python3.6/ctypes/__init__.py中修改什么吗? Where should libgdal.so be? libgdal.so 应该在哪里?

in my .bash_profile I've set:在我的.bash_profile我设置:

export PATH="/usr/local/opt/gdal2/bin:$PATH"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH source /Users/me/.bash_profile

And I can confirm GDAL's installed:我可以确认安装了GDAL:

$ which gdal-config

/Library/Frameworks/GDAL.framework/Programs/gdal-config

$ gdal-config --version

2.3.2

I've tried uninstalling and reinstalling gdal with both pip3 and homebrew.我尝试使用 pip3 和自制软件卸载并重新安装 gdal。

Homebrew GDAL install will err out while installing openblas dependency: Homebrew GDAL install 在安装 openblas 依赖项时会出错:

==> Installing gdal dependency: openblas
==> make CC=gcc-11 FC=gfortran libs netlib shared
Last 15 lines from /Users/chrisbolman/Library/Logs/Homebrew/openblas/01.make:
                     ^~~~~~
<stdin>:2239:16: error: register %xmm16 is only available with AVX512
        vaddss  %xmm1, %xmm16, %xmm0
                       ^~~~~~
<stdin>:2240:12: error: register %xmm16 is only available with AVX512
        vunpckhps       %xmm16, %xmm16, %xmm1
                        ^~~~~~
<stdin>:2241:16: error: register %xmm16 is only available with AVX512
        vshufps $255, %xmm16, %xmm16, %xmm16
                      ^~~~~~
<stdin>:2243:9: error: register %xmm16 is only available with AVX512
        vaddss  %xmm16, %xmm0, %xmm0
                ^~~~~~
make[1]: *** [sgemv_t_SKYLAKEX.o] Error 1
make: *** [libs] Error 1

with Pip3 install throws a large err I haven't seen previously:使用 Pip3 install 会引发我以前从未见过的大错误:

Building wheels for collected packages: gdal
  Building wheel for gdal (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/me/.pyenv/versions/3.6.5/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-qr01e55h/gdal_a0b36daf2b604b5eb109540e4f61fe11/setup.py'"'"'; __file__='"'"'/private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-qr01e55h/gdal_a0b36daf2b604b5eb109540e4f61fe11/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-wheel-dzc9_qmw
       cwd: /private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-qr01e55h/gdal_a0b36daf2b604b5eb109540e4f61fe11/
  Complete output (39 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.13-x86_64-3.6
  copying gdal.py -> build/lib.macosx-10.13-x86_64-3.6
  copying ogr.py -> build/lib.macosx-10.13-x86_64-3.6
  copying osr.py -> build/lib.macosx-10.13-x86_64-3.6
  copying gdalconst.py -> build/lib.macosx-10.13-x86_64-3.6
  copying gnm.py -> build/lib.macosx-10.13-x86_64-3.6
  copying gdalnumeric.py -> build/lib.macosx-10.13-x86_64-3.6
  creating build/lib.macosx-10.13-x86_64-3.6/osgeo
  copying osgeo/gnm.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
  copying osgeo/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
  copying osgeo/gdalnumeric.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
  copying osgeo/osr.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
  copying osgeo/gdal.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
  copying osgeo/ogr.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
  copying osgeo/gdal_array.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
  copying osgeo/gdalconst.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
  Fixing build/lib.macosx-10.13-x86_64-3.6/gdal.py build/lib.macosx-10.13-x86_64-3.6/ogr.py build/lib.macosx-10.13-x86_64-3.6/osr.py build/lib.macosx-10.13-x86_64-3.6/gdalconst.py build/lib.macosx-10.13-x86_64-3.6/gnm.py build/lib.macosx-10.13-x86_64-3.6/gdalnumeric.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gnm.py build/lib.macosx-10.13-x86_64-3.6/osgeo/__init__.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdalnumeric.py build/lib.macosx-10.13-x86_64-3.6/osgeo/osr.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdal.py build/lib.macosx-10.13-x86_64-3.6/osgeo/ogr.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdal_array.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdalconst.py
  Skipping optional fixer: ws_comma
  Fixing build/lib.macosx-10.13-x86_64-3.6/gdal.py build/lib.macosx-10.13-x86_64-3.6/ogr.py build/lib.macosx-10.13-x86_64-3.6/osr.py build/lib.macosx-10.13-x86_64-3.6/gdalconst.py build/lib.macosx-10.13-x86_64-3.6/gnm.py build/lib.macosx-10.13-x86_64-3.6/gdalnumeric.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gnm.py build/lib.macosx-10.13-x86_64-3.6/osgeo/__init__.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdalnumeric.py build/lib.macosx-10.13-x86_64-3.6/osgeo/osr.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdal.py build/lib.macosx-10.13-x86_64-3.6/osgeo/ogr.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdal_array.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdalconst.py
  Skipping optional fixer: ws_comma
  running build_ext
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/me/.pyenv/versions/3.6.5/include/python3.6m -I/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/2.3/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/me/.pyenv/versions/3.6.5/include/python3.6m -I/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/2.3/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o -std=c++11
  building 'osgeo._gdal' extension
  creating build/temp.macosx-10.13-x86_64-3.6
  creating build/temp.macosx-10.13-x86_64-3.6/extensions
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/me/.pyenv/versions/3.6.5/include/python3.6m -I/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/2.3/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.13-x86_64-3.6/extensions/gdal_wrap.o -std=c++11 -I/Library/Frameworks/GDAL.framework/Versions/2.3/Headers
  warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
  1 warning generated.
  clang++ -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl@1.1/lib -L/Users/me/.pyenv/versions/3.6.5/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl@1.1/lib -L/Users/me/.pyenv/versions/3.6.5/lib -Wno-error=unused-command-line-argument-hard-error-in-future build/temp.macosx-10.13-x86_64-3.6/extensions/gdal_wrap.o -L../../.libs -L../../ -L/Library/Frameworks/GDAL.framework/Versions/2.3/lib -lgdal -o build/lib.macosx-10.13-x86_64-3.6/osgeo/_gdal.cpython-36m-darwin.so
  ld: warning: directory not found for option '-L../../.libs'
  ld: warning: directory not found for option '-L/Library/Frameworks/GDAL.framework/Versions/2.3/lib'
  ld: library not found for -lgdal
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'clang++' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for gdal
  Running setup.py clean for gdal
Failed to build gdal
Installing collected packages: gdal
    Running setup.py install for gdal ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/me/.pyenv/versions/3.6.5/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-qr01e55h/gdal_a0b36daf2b604b5eb109540e4f61fe11/setup.py'"'"'; __file__='"'"'/private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-qr01e55h/gdal_a0b36daf2b604b5eb109540e4f61fe11/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-record-zfnxov4z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/me/.pyenv/versions/3.6.5/include/python3.6m/gdal
         cwd: /private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-qr01e55h/gdal_a0b36daf2b604b5eb109540e4f61fe11/
    Complete output (39 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-x86_64-3.6
    copying gdal.py -> build/lib.macosx-10.13-x86_64-3.6
    copying ogr.py -> build/lib.macosx-10.13-x86_64-3.6
    copying osr.py -> build/lib.macosx-10.13-x86_64-3.6
    copying gdalconst.py -> build/lib.macosx-10.13-x86_64-3.6
    copying gnm.py -> build/lib.macosx-10.13-x86_64-3.6
    copying gdalnumeric.py -> build/lib.macosx-10.13-x86_64-3.6
    creating build/lib.macosx-10.13-x86_64-3.6/osgeo
    copying osgeo/gnm.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
    copying osgeo/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
    copying osgeo/gdalnumeric.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
    copying osgeo/osr.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
    copying osgeo/gdal.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
    copying osgeo/ogr.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
    copying osgeo/gdal_array.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
    copying osgeo/gdalconst.py -> build/lib.macosx-10.13-x86_64-3.6/osgeo
    Fixing build/lib.macosx-10.13-x86_64-3.6/gdal.py build/lib.macosx-10.13-x86_64-3.6/ogr.py build/lib.macosx-10.13-x86_64-3.6/osr.py build/lib.macosx-10.13-x86_64-3.6/gdalconst.py build/lib.macosx-10.13-x86_64-3.6/gnm.py build/lib.macosx-10.13-x86_64-3.6/gdalnumeric.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gnm.py build/lib.macosx-10.13-x86_64-3.6/osgeo/__init__.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdalnumeric.py build/lib.macosx-10.13-x86_64-3.6/osgeo/osr.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdal.py build/lib.macosx-10.13-x86_64-3.6/osgeo/ogr.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdal_array.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdalconst.py
    Skipping optional fixer: ws_comma
    Fixing build/lib.macosx-10.13-x86_64-3.6/gdal.py build/lib.macosx-10.13-x86_64-3.6/ogr.py build/lib.macosx-10.13-x86_64-3.6/osr.py build/lib.macosx-10.13-x86_64-3.6/gdalconst.py build/lib.macosx-10.13-x86_64-3.6/gnm.py build/lib.macosx-10.13-x86_64-3.6/gdalnumeric.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gnm.py build/lib.macosx-10.13-x86_64-3.6/osgeo/__init__.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdalnumeric.py build/lib.macosx-10.13-x86_64-3.6/osgeo/osr.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdal.py build/lib.macosx-10.13-x86_64-3.6/osgeo/ogr.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdal_array.py build/lib.macosx-10.13-x86_64-3.6/osgeo/gdalconst.py
    Skipping optional fixer: ws_comma
    running build_ext
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/me/.pyenv/versions/3.6.5/include/python3.6m -I/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/2.3/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/me/.pyenv/versions/3.6.5/include/python3.6m -I/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/2.3/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o -std=c++11
    building 'osgeo._gdal' extension
    creating build/temp.macosx-10.13-x86_64-3.6
    creating build/temp.macosx-10.13-x86_64-3.6/extensions
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/me/.pyenv/versions/3.6.5/include/python3.6m -I/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/2.3/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.13-x86_64-3.6/extensions/gdal_wrap.o -std=c++11 -I/Library/Frameworks/GDAL.framework/Versions/2.3/Headers
    warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
    1 warning generated.
    clang++ -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl@1.1/lib -L/Users/me/.pyenv/versions/3.6.5/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl@1.1/lib -L/Users/me/.pyenv/versions/3.6.5/lib -Wno-error=unused-command-line-argument-hard-error-in-future build/temp.macosx-10.13-x86_64-3.6/extensions/gdal_wrap.o -L../../.libs -L../../ -L/Library/Frameworks/GDAL.framework/Versions/2.3/lib -lgdal -o build/lib.macosx-10.13-x86_64-3.6/osgeo/_gdal.cpython-36m-darwin.so
    ld: warning: directory not found for option '-L../../.libs'
    ld: warning: directory not found for option '-L/Library/Frameworks/GDAL.framework/Versions/2.3/lib'
    ld: library not found for -lgdal
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang++' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/me/.pyenv/versions/3.6.5/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-qr01e55h/gdal_a0b36daf2b604b5eb109540e4f61fe11/setup.py'"'"'; __file__='"'"'/private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-qr01e55h/gdal_a0b36daf2b604b5eb109540e4f61fe11/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-record-zfnxov4z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/me/.pyenv/versions/3.6.5/include/python3.6m/gdal Check the logs for full command output.

I can see the gdal build fail and that it's not finding the directory's and libs it needs, but I'm having difficulty troubleshooting this further - it seems like a symlinks issue or an issue with the pyenv environment or version.我可以看到 gdal 构建失败并且它没有找到它需要的目录和库,但我很难进一步解决这个问题 - 这似乎是一个符号链接问题或 pyenv 环境或版本的问题。

/Library/Frameworks/GDAL.framework exists, so why the ld: warning: directory not found for option '-L/Library/Frameworks/GDAL.framework/Versions/2.3/lib' ? /Library/Frameworks/GDAL.framework存在,那么为什么ld: warning: directory not found for option '-L/Library/Frameworks/GDAL.framework/Versions/2.3/lib'

I am able to install gdal with conda.我可以用 conda 安装 gdal。

If I run conda info --all | grep -i python如果我运行conda info --all | grep -i python conda info --all | grep -i python

I see:我懂了:

python version : 3.7.1.final.0
             user-agent : conda/4.11.0 requests/2.25.0 CPython/3.7.1 Darwin/17.7.0 OSX/10.13.6
sys.executable: /miniconda3/bin/python
conda location: /miniconda3/lib/python3.7/site-packages/conda
user site dirs: ~/.local/lib/python2.7
CONDA_PYTHON_EXE: /Users/me/miniconda3/bin/python
PATH: /Users/me/.pyenv/shims:/Users/me/Dropbox/br/venv-br/bin:/usr/local/sbin:/Library/Frameworks/GDAL.framework/Programs:/Library/Frameworks/GDAL.framework/Headers:/Library/Frameworks/GDAL.framework/Headers:/miniconda3/bin:/Library/Frameworks/GDAL.framework/Programs:/Users/me/.pyenv/bin:/usr/local/opt/gdal2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/bin:/opt/X11/bin

Then the problem here is I can see is there's a versioning/path issue where the path is python2.7 but the project is running 3.6.5.然后这里的问题是我可以看到存在版本控制/路径问题,其中路径是 python2.7 但项目正在运行 3.6.5。 Is there a way to do a python version and environment-specific install of gdal?有没有办法进行 Gdal 的 python 版本和特定环境的安装?

if I try, for example, pip3 install pygdal例如,如果我尝试pip3 install pygdal

Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-shzb0zgv/pygdal_e5bb5d1ae6fc4b249277714a57d6e5bf/setup.py", line 253, in <module>
      **extra
    File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "/Users/chrisbolman/.pyenv/versions/3.6.5/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/me/.pyenv/versions/3.6.5/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-shzb0zgv/pygdal_e5bb5d1ae6fc4b249277714a57d6e5bf/setup.py", line 89, in run
      inst_gdal_version, GDAL_VERSION))
  __main__.GDALConfigError: Version mismatch 2.3.2 != 3.3.2
  ----------------------------------------
  ERROR: Failed building wheel for pygdal

but I also can't specify a matching version, because if I try to install pip3 install pygdal==2.3.2.10 install throws the same clang err:但我也无法指定匹配的版本,因为如果我尝试安装pip3 install pygdal==2.3.2.10 install 会抛出相同的 clang 错误:

 ld: warning: directory not found for option '-L/Library/Frameworks/GDAL.framework/Versions/2.3/lib'
    ld: library not found for -lgdal
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang++' failed with exit status 1

Thanks谢谢

The immediate problem is that you uninstalled GDAL and haven't been able to successfully reinstall it (both pip and homebrew failed to compile the files that will result in libgdal.so being generated. Using the django.contrib.gis.gdal Python package requires having the GDAL library installed successfully. The installers expect this library to be locatable/loadable using the "normal" methods for loading libraries and thus don't respect the GDAL_LIBRARY_PATH environment variable. The immediate problem is that you uninstalled GDAL and haven't been able to successfully reinstall it (both pip and homebrew failed to compile the files that will result in libgdal.so being generated. Using the django.contrib.gis.gdal Python package requires成功安装了GDAL安装程序希望该库可以使用“正常”方法加载库来定位/加载,因此不尊重GDAL_LIBRARY_PATH环境变量。

Take a look at the instructions to build GDAL from source.查看从源代码构建 GDAL 的说明。 It specifically mentions the error you're having.它特别提到了您遇到的错误。 Also note on that page that GDAL_LIBRARY_PATH should be set to the path of libgdal.so , not libgdal.py , though you mention somehow the latter was working for you it may be worth fixing once you've built/installed the GDAL library.另请注意,在该页GDAL_LIBRARY_PATH应该设置为libgdal.so的路径,而不是libgdal.py ,尽管您提到后者以某种方式为您工作,一旦您构建/安装了 GDAL 库,它可能值得修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 python picamera OSError:dlopen(libmmal.so,6):找不到图片 - python picamera OSError: dlopen(libmmal.so, 6): image not found 在 MacOSX High Sierra 上安装 caffe/pycaffe - Install caffe/pycaffe on MacOSX High Sierra oserror dlopen 找不到合适的图像 python 3 - oserror dlopen no suitable image found python 3 OSError: dlopen(libSystem.dylib, 6): 找不到图像 - OSError: dlopen(libSystem.dylib, 6): image not found 无法在Mac OSC High Sierra上安装Python GDAL - Cannot install Python GDAL on Mac OSC High Sierra 无法在 macos Sierra 的 python 3.6.1 中安装 gdal - Unable to install gdal in python 3.6.1 in macos Sierra “OSError:dlopen(libSystem.dylib,6):找不到图像”(OS X + macports + Celery 3.1.7) - “OSError: dlopen(libSystem.dylib, 6): image not found” (OS X + macports + Celery 3.1.7) python软件包导致OSError:dlopen(libcilin_similarity.dylib,6):找不到图片 - python package cause OSError: dlopen(libcilin_similarity.dylib, 6): image not found “ Apple Python”:OSError:dlopen(libps2000a.dylib,6):未找到图像,但在IPython中未找到 - “Apple Python” : OSError: dlopen(libps2000a.dylib, 6): image not found but not in IPython OSError: /usr/lib/libgdal.so.20: 未定义符号: sqlite3_column_table_name - OSError: /usr/lib/libgdal.so.20: undefined symbol: sqlite3_column_table_name
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM