【问题标题】:installing gdal in pycharm在pycharm中安装gdal
【发布时间】:2021-07-08 20:37:01
【问题描述】:

我已经尝试在 PyCharm 中导入“gdal”几个小时了,但没有成功,我现在也不知道了。

我在 Anaconda Powershell 中安装了 gdal:

conda install gdal,

这似乎奏效了,我得到“# All requested packages already installed”。另外,当我点击conda list 时,gdal 被列为软件包之一(gdal 2.3.3)。

现在,通常它可以在 PyCharm 中工作。然而,这一次没有。我尝试了什么:

  • 在 PyCharm 中,我将鼠标悬停在 import gdal 上并尝试安装该软件包,但没有成功。
  • 在 PyCharm 中,设置 -> 项目解释器 -> “+” -> 尝试在那里安装“GDAL”包,但也没有成功。
  • 在 PyCharm 中,Settings -> Project Interpreter -> "Show All" -> "Show paths for the selected interpreter" -> 在那里我添加了“gdal-2.3.3-py37hdf43c64_0”目录的路径(“C: ...\AppData\Local\Continuum\anaconda3\pkgs"),但没有成功。

有什么想法吗?谢谢!

【问题讨论】:

  • 为什么不在 PyCharm 中使用这个 conda 解释器?安装 gdal 失败时收到什么错误?

标签: python-3.x pycharm gdal


【解决方案1】:

在任何地方使用 conda 的最佳方法是使用以下命令安装 conda 环境,然后在 pycharm 中使用相同的环境。

Conda 环境安装命令:

conda create -n gdal python=3.7
activate gdal
conda install -c conda-forge gdal

在pycharm中设置conda环境:

-> Go to Preferences / settings in pycharm 
-> Search for `python interpreter` 
-> Click on the drop down and then click on show all
-> Click on the + symbol to add the environment
-> Click on Conda environment in the left panel and select existing environment
-> Select the exact path of python3.7 (or other version) where the environment is installed (/opt/anaconda3/envs/gis/bin/python3.7 - in case of mac)

这应该可以完成工作。

【讨论】:

    猜你喜欢
    • 2020-08-01
    • 1970-01-01
    • 2017-06-30
    • 1970-01-01
    • 2017-07-23
    • 2020-06-18
    • 2018-07-30
    • 2015-11-11
    • 1970-01-01
    相关资源
    最近更新 更多