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

一时失言乱红尘 2023-06-25 06:25 207阅读 0赞

问题: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
原因如下:watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3N1cnNlcnJy_size_16_color_FFFFFF_t_70

解决方法一:

添加 Anaconda Python 免费仓库:

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

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

  1. conda config --show

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

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

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

  1. 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/ 阿里镜像

解决方法二:

  1. anaconda search -t conda X

X为要安装的包

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

X为包的具体名称
例:首先输入 anaconda search -t conda lifelines,这样子就会显示可用的版本 ,我的显示效果如下所示:

format_png

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

conda install -c https://conda.anaconda.org/conda-forge lifelines, 注意conda-forge和lifelines之间没有“/”。

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

发表评论

表情:
评论列表 (有 0 条评论,207人围观)

还没有评论,来说两句吧...

相关阅读