pip uninstall GDAL 给出 AttributeError: 'PathMetadata'对象没有属性“isdir”;

发布于 2025-01-12 23:06:13 字数 1842 浏览 0 评论 0原文

我正在尝试将 pip install geopandas 作为全新安装,因此我想删除 GDALfiona 等现有软件包。我已经成功pip uninstall fiona,但是当我尝试卸载或重新安装GDAL时,它会显示以下错误消息:

(base) C:\usr>pip install C:/usr/Anaconda3/Lib/site-packages/GDAL-3.4.1-cp38-cp38-win_amd64.whl
Processing c:\usr\anaconda3\lib\site-packages\gdal-3.4.1-cp38-cp38-win_amd64.whl
Installing collected packages: GDAL
  Attempting uninstall: GDAL
    Found existing installation: GDAL 3.0.2
ERROR: Exception:
Traceback (most recent call last):
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 405, in run
    installed = install_given_reqs(
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\__init__.py", line 68, in install_given_reqs
    uninstalled_pathset = requirement.uninstall(auto_confirm=True)
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\req_install.py", line 637, in uninstall
    uninstalled_pathset = UninstallPathSet.from_dist(dist)
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 554, in from_dist
    for script in dist.iterdir("scripts"):
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\metadata\pkg_resources.py", line 156, in iterdir
    if not self._dist.isdir(name):
  File "C:\usr\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2816, in __getattr__
    return getattr(self._provider, attr)
AttributeError: 'PathMetadata' object has no attribute 'isdir'

有谁知道为什么GDAL代码>无法卸载?

I'm trying to pip install geopandas as a fresh installation, so I want to remove existing packages like GDAL and fiona. I've already managed to pip uninstall fiona, but when I try to uninstall or reinstall GDAL it gives the following error message:

(base) C:\usr>pip install C:/usr/Anaconda3/Lib/site-packages/GDAL-3.4.1-cp38-cp38-win_amd64.whl
Processing c:\usr\anaconda3\lib\site-packages\gdal-3.4.1-cp38-cp38-win_amd64.whl
Installing collected packages: GDAL
  Attempting uninstall: GDAL
    Found existing installation: GDAL 3.0.2
ERROR: Exception:
Traceback (most recent call last):
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 405, in run
    installed = install_given_reqs(
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\__init__.py", line 68, in install_given_reqs
    uninstalled_pathset = requirement.uninstall(auto_confirm=True)
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\req_install.py", line 637, in uninstall
    uninstalled_pathset = UninstallPathSet.from_dist(dist)
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 554, in from_dist
    for script in dist.iterdir("scripts"):
  File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\metadata\pkg_resources.py", line 156, in iterdir
    if not self._dist.isdir(name):
  File "C:\usr\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2816, in __getattr__
    return getattr(self._provider, attr)
AttributeError: 'PathMetadata' object has no attribute 'isdir'

Does anyone know why GDAL cannot be uninstalled?

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

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

发布评论

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

评论(2

单身情人 2025-01-19 23:06:13

我在遇到同样的错误后才遇到这个问题。巧合的是,我刚刚升级了 pip(我厌倦了黄色警告)。

我所要做的就是降低我的点子等级

pip install pip==21.3.1 --user

I just came across this question after getting the same error. Coincidentally I had just upgraded pip (I was getting tired of the yellow warnings).

All I had was to down grade my pip

pip install pip==21.3.1 --user
丢了幸福的猪 2025-01-19 23:06:13

当我尝试安装 google-cloud-firestore 时,我看到了与您相同的 AttributeError。我的解决方案是升级我的 pip 版本。就我而言,我从 22.0.2 升级到 pip 到 22.3.1

pip install --upgrade pip

I was seeing the same AttributeError as you when trying to install google-cloud-firestore. My solution was to upgrade my version of pip. In my case, I upgraded to pip from 22.0.2 to 22.3.1

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