天天看點

【Anaconda】.condarc出現問題解決辦法

Anaconda中.condarc可能在我們修改下載下傳源的時候改動,然後導緻在執行指令時各種報錯

Traceback (most recent call last):
      File "D:\anaconda\lib\site-packages\conda\core\subdir_data.py", line 251, in _load
        raise UnavailableInvalidChannel(self.url_w_repodata_fn, 404)
    conda.exceptions.UnavailableInvalidChannel: The channel is not accessible or is invalid.
      channel name: anaconda/cloud/conda-forge
      channel url: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
      error code: 404

    You will need to adjust your conda configuration to proceed.
    Use `conda config --show channels` to view your configuration's current state,
    and use `conda config --show-sources` to view config file locations.


    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "D:\anaconda\lib\site-packages\conda\core\subdir_data.py", line 248, in _load
        repodata_fn=self.repodata_fn)
      File "D:\anaconda\lib\site-packages\conda\core\subdir_data.py", line 598, in fetch_repodata_remote_request
        raise Response304ContentUnchanged()
    conda.core.subdir_data.Response304ContentUnchanged

           

那麼這時候可以嘗試一下,重新設定一下.condarc檔案

conda config --set show_channel_urls yes
           

再配置一下.condarc:

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud