无法在Anaconda虚拟环境中安装软件包。 “当前频道无法提供套餐”

时间:2019-10-31 20:35:32

标签: python anaconda conda

我正在尝试在Anaconda中创建一个新的Python环境。我正在使用Anaconda Powershell Prompt并使用

创建环境
conda create --name adwp1 python=3.5 -y;
conda activate adwp1  
conda install notebook=4.2.3 -y;

pip install notebook=4.2.3

使用 conda install

时出现以下错误
    Collecting package metadata (current_repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
    Collecting package metadata (repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.

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

  - notebook=4.2.3

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

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

    https://anaconda.org

,然后使用页面顶部的搜索栏。

**,当我使用** pip install 时,出现以下错误

  

错误:无效的要求:'notebook = 4.2.3'提示:=无效   操作员。你是说==吗?

2 个答案:

答案 0 :(得分:2)

该版本的软件包在官方存储库中不可用,因此您必须从其他地方安装它。 幸运的是,这在conda-forge用户维护的存储库中可用。 如果您信任软件包的维护者,则只需执行以下操作即可:

conda install -c conda-forge -y notebook=4.2.3

编辑

根据@merv注释,也可以通过restoring the free channel searching获取此软件包,这基本上可以通过将1环境变量设置为CONDA_RESTORE_FREE_CHANNEL来完成:

CONDA_RESTORE_FREE_CHANNEL=1 conda install -y notebook=4.2.3

或通过将相应的配置标志设置为true

conda config --set restore_free_channel true

pip命令而言,这只是一个错字(如错误消息中所建议):用=替换==应该可以解决问题:

pip install notebook==4.2.3

答案 1 :(得分:0)

当我使用以下代码时,它会起作用

pip install notebook==4.2.3

感谢norok2