安装rasterio

发布于 2025-02-11 22:00:28 字数 226 浏览 1 评论 0原文

我尝试使用Command-pip install rasterio安装rasterio库,并在Anaconda CMD中使用了Conda命令,两个都没有工作,并且要安装时间太长,因此我中止了该过程。让我详细地知道如何为Python安装Raserio库?

我尝试使用PIP命令安装GDAL和RATERIO WHL文件。它已安装,但是当我尝试导入模块时,它给了我一个错误,说找不到模块。请帮助解决此问题。

提前致谢

I tried installing Rasterio library using command- pip install rasterio and also used conda commands in anaconda cmd, both are didn't worked and it's taking too long to install so I aborted the process. Let me know in detail how to install raserio library for python?

I tried with installing GDAL and raterio whl file by using pip commands. It got installed, but when I tried to import module- it's giving me an error saying No module found. Please help to fix this.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若言繁花未落 2025-02-18 22:00:28

我只是遇到了类似的问题,TL:DR对我来说是多种环境,就像Ameya所说。这是Ameya的较长版本的点对点答案,并进行了诊断和修复的步骤。

Without realizing it, I had two environments going on: my jupyter notebook was running python 3.10 and my global python was running 3.9, and each was looking for site-packages in different locations (/opt/homebrew/Cellar/jupyterlab/3.4.7 /libexec/lib/python3.10/site-packages vs/users//library/python/3.9/lib/site-packages)。

之所以发生这种情况,是因为我在让Python,特别是Jupyterlab在Monterey上运行时遇到了麻烦,对我来说,唯一的解决方法是使用自制工作来管理包裹。我从命令行中安装的任何东西都进入/opt/opt/homebrew/cellar ...等,我的jupyter笔记本可以看到。我使用PIP安装的任何内容都可以从打开的笔记本电脑中获得,也进入了我笔记本可以看到的这条路径。但是,我从命令行中使用PIP安装的任何东西都进入了全局环境网站软件包的路径。然后,我的Jupyter笔记本看不到它们。

您没有提到您正在使用Jupyter笔记本电脑,但是在多个环境之间可能会发生类似的事情。

您可以通过执行以下操作来检查是否是这种情况:

  1. 从命令行启动python
  2. import sys
  3. runs.path
  4. 开始jupyter笔记本,或从其他环境中启动python,从您的其他环境开始
  5. ,导入sys,run sys.path

是他们相同?如果没有,可能会将您的rasterio放入其他Python Env网站包装中。

要修复,您可以在首选的环境中从一个站点包装的位置到另一个站点包装,然后将与Rasterio相对应的站点软件包复制并粘贴到另一个位置。

I just had the similar problem, and tl:dr the issue for me was multiple environments, like Ameya said. Here's a longer version of Ameya's spot-on answer with steps to diagnose and fix.

Without realizing it, I had two environments going on: my jupyter notebook was running python 3.10 and my global python was running 3.9, and each was looking for site-packages in different locations (/opt/homebrew/Cellar/jupyterlab/3.4.7/libexec/lib/python3.10/site-packages vs /Users//Library/Python/3.9/lib/site-packages).

This happened because I had trouble with getting python and specifically jupyterlab running on Monterey and the only fix for me was using homebrew to manage the packages. Anything I installed with brew from the command line, went into /opt/homebrew/Cellar... etc and could be seen by my jupyter notebook. Anything I used pip install to get from within an open notebook also went onto this path that my notebook could see. But anything I used pip install from the command line to get, went to the path of the global environment's site packages. Then, my jupyter notebook couldn't see them.

You don't mention that you are using jupyter notebook but perhaps something analogous could happen between multiple environments for you.

You can check if this is the case for you by doing the following:

  1. start python from the command line
  2. import sys
  3. run sys.path
  4. start jupyter notebook, or start python from your other environment
  5. same thing, import sys, run sys.path

Are they the same? If not, probably pip is putting your rasterio in other python env site-packages.

To fix, you can either pip install from within your preferred environment, or copy and paste the site packages corresponding to rasterio from one site-packages location to the other.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文