PackagesNotFoundError: The following packages are not available from current channels 解决办法

  • Post author:
  • Post category:其他


问题:

PackagesNotFoundError: The following packages are not available from current channels


问题一:

因为要用到lifelines 包,在cmd中使用conda install lifelines ,显示如下错误:


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


– lifelines


Current channels:


– https://conda.anaconda.org/derickl/win-64



– https://conda.anaconda.org/derickl/noarch



– https://repo.anaconda.com/pkgs/main/win-64



– https://repo.anaconda.com/pkgs/main/noarch



– https://repo.anaconda.com/pkgs/free/win-64



– https://repo.anaconda.com/pkgs/free/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


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


问题二:

UnavailableInvalidChannel: The channel is not accessible or is invalid.

channel name: anaconda/pkgs/free

channel url: https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

error code: 404

原因如下:


解决方法一:

添加 Anaconda Python 免费仓库:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

检查Anaconda的config:查看channel个数以及格式,显然觉得有一个是有问题的:

conda config --show 

参照 conda config 说明,移除某些channel  :

conda config --remove channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' 

或者可以使用 下面命令换回默认源:

conda config --remove-key channels


不过还有简单粗暴地方法:

直接修改conda的配置,一般在当前用户路径下,比如C:\Users\Administrator\.condarc.condarc具体内容如下:show_channel_urls: truechannels:

– https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

– defaults

现在清华镜像不能使用了,删除这个镜像,可以试一下下面的镜像:



http://pypi.douban.com/simple/

豆瓣镜像



http://mirrors.aliyun.com/pypi/simple/

阿里镜像


解决方法二:

anaconda search -t conda X

X为要安装的包

conda install -c https://conda.anaconda.org/X-path  X

X为包的具体名称

例:首先输入

anaconda search -t conda lifelines,

这样子就会显示可用的版本 ,我的显示效果如下所示:

选择适合自己的版本,比如,我选择的就是conda-forge/lifelines,在命令行中输入:


conda install -c https://conda.anaconda.org/conda-forge lifelines, 注意

conda-forge和

lifelines之间没有“/”。


参考:

https://www.cnblogs.com/hellojiaojiao/p/10790273.html



版权声明:本文为marleylee原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。