程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

python中gdal導入問題(環境變量)

編輯:Python
問題遇到的現象和發生背景

嘗試運行 conda update conda 命令以後,在 spyder 中嘗試通過 from osgeo import gdal 導入 gdal,出現錯誤“ImportError: DLL load failed while importing _gdal: 找不到指定的模塊。”

運行結果及報錯內容
from osgeo import gdalTraceback (most recent call last): File ~\anaconda3\lib\site-packages\osgeo\__init__.py:29 in swig_import_helper return importlib.import_module(mname) File ~\anaconda3\lib\importlib\__init__.py:127 in import_module return _bootstrap._gcd_import(name[level:], package, level) File

_gdal = swig_import_helper() File ~\anaconda3\lib\site-packages\osgeo\
__init__.py:
41
in swig_import_helper raise ImportError(traceback_string +
'\n' + msg)ImportError: Traceback (most recent
call last): File
"C:\Users\p676p\anaconda3\lib\site-packages\osgeo\__init__.py", line
29,
in swig_import_helper return importlib.import_module(mname) File
"C:\Users\p676p\anaconda3\lib\importlib\__init__.py", line
127,
in import_module return
_bootstrap.
_gcd_import(
name[level:], package, level) File
"

"
, line
1030,
in
_gcd_import File
"

"
, line
1007,
in
_find_and_load File
"

"
, line
986,
in
_find_and_load_unlocked File
"

"
, line
666,
in
_load_unlocked File
"

"
, line
565,
in module_from_spec File
"

"
, line
1173,
in create_module File
"

"
, line
228,
in
_call_with_frames_removedImportError: DLL
load failed
while importing
_gdal: 找不到指定的模塊。On Windows,
with Python >=
3.8, DLLs are no longer imported
from the PATH.
If gdalXXX.dll is
in the PATH,
then
set the USE_PATH_FOR_GDAL_PYTHON=YES environment variable
to feed the PATH into os.add_dll_directory().








我的解答思路和嘗試過的方法

不知道如何解決

我想要達到的結果

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved