Anaconda:“ModuleNotFoundError:没有名为“gower”的模块”。模块在 conda 中不可用,但仅在 pip 中可用。即使使用 pip 安装后也出现同样的错误

问题描述 投票:0回答:1
pip install gower

Defaulting to user installation because normal site-packages is not writeable
Looking in links: /usr/share/pip-wheels
Collecting gower
  Using cached gower-0.1.2-py3-none-any.whl (5.2 kB)
Requirement already satisfied: scipy in /opt/conda/envs/anaconda-2022.05-py39/lib/python3.9/site-packages (from gower) (1.7.3)
Requirement already satisfied: numpy in /opt/conda/envs/anaconda-2022.05-py39/lib/python3.9/site-packages (from gower) (1.21.5)
Installing collected packages: gower
Successfully installed gower-0.1.2
Note: you may need to restart the kernel to use updated packages.

这样就安装好了,但是只能用pip安装,不能用conda安装,而且找不到模块:

import gower

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[3], line 1
----> 1 import gower

ModuleNotFoundError: No module named 'gower'

我也尝试用 conda 安装它,但它不在 conda 包管理器中:

conda install gower

Channels:
 - defaults
 - conda-forge
 - pytorch
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - gower

Current channels:

  - defaults
  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://conda.anaconda.org/pytorch/linux-64
  - https://conda.anaconda.org/pytorch/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.



Note: you may need to restart the kernel to use updated packages.

在测试过程中,我始终处于同一个虚拟环境中,该环境是 Anaconda.com 上在线提供的“anaconda-2022.05-py39”虚拟环境。切换到“anaconda-panel-2023.05-py310”时,错误是相同的。

如何才能让

import gower
运行?

python python-3.x pip anaconda
1个回答
0
投票

正如 pip 安装程序的输出所示:

Note: you may need to restart the kernel to use updated packages.

当我切换回“anaconda-2022.05-py39”并触发内核重新启动时,找到了

gower
模块。我忘记了这一点并监督了注释。

© www.soinside.com 2019 - 2024. All rights reserved.