admin 管理员组文章数量: 1086019
I have installed gdal at Anaconda base prompt using "conda install -c conda-fe gdal" and also created separate conda environment (geo) and installed at this location using the same command. I requested gdal version and also from python prompt entered "from osgeo import gdal" and received no errors from either the base or geo environs.
I opened up Spyder from the Anaconda Navigator and added paths to C:\Users\users\anaconda3\Lib and also C:\Users\users\anaconda3\envs\geo\Lib. When I attempt to run python code in Spyder with "import gdal" I receive "ModuleNotFoundError: No module named gdal". I used "from osgeo import gdal" instead of "import gdal" as suggested by others and did not get any errors but code does not seem to recognize gdal commands. After internet search I cannot find anything else to do. Maybe other Spyder settings? Any suggestions would be appreciated. Thanks. Using: Windows 11 Python 3.12 Conda 25.3.0 gdal 3.6.2 Spyder 5.5.1
I have installed gdal at Anaconda base prompt using "conda install -c conda-fe gdal" and also created separate conda environment (geo) and installed at this location using the same command. I requested gdal version and also from python prompt entered "from osgeo import gdal" and received no errors from either the base or geo environs.
I opened up Spyder from the Anaconda Navigator and added paths to C:\Users\users\anaconda3\Lib and also C:\Users\users\anaconda3\envs\geo\Lib. When I attempt to run python code in Spyder with "import gdal" I receive "ModuleNotFoundError: No module named gdal". I used "from osgeo import gdal" instead of "import gdal" as suggested by others and did not get any errors but code does not seem to recognize gdal commands. After internet search I cannot find anything else to do. Maybe other Spyder settings? Any suggestions would be appreciated. Thanks. Using: Windows 11 Python 3.12 Conda 25.3.0 gdal 3.6.2 Spyder 5.5.1
Share Improve this question asked Mar 28 at 13:13 RathprRathpr 35 bronze badges1 Answer
Reset to default 0The above method did work and the key was to use "from osgeo import gdal" instead of "import gdal". The gdal code that I copied from elsewhere had errors. When I corrected the code it worked.
本文标签: Anaconda Spyder will not import gdalStack Overflow
版权声明:本文标题:Anaconda Spyder will not import gdal - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744035665a2522316.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论