【Anaconda环境问题】在anaconda中创建虚拟环境失败的解决方法

一、问题描述

(base) C:\Users\Hasee>conda create -n opencv123 python=3.7
Collecting package metadata (current_repodata.json): failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 531, in fetch_repodata_remote_request
        resp.raise_for_status()
      File "D:\Users\Hasee\anaconda3\lib\site-packages\requests\models.py", line 1021, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch/current_repodata.json

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "D:\Users\Hasee\anaconda3\lib\site-packages\requests\models.py", line 971, in json
        return complexjson.loads(self.text, **kwargs)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\simplejson\__init__.py", line 525, in loads
        return _default_decoder.decode(s)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\simplejson\decoder.py", line 370, in decode
        obj, end = self.raw_decode(s)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode
        return self.scan_once(s, idx=_w(s, idx).end())
    simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\exceptions.py", line 1129, in __call__
        return func(*args, **kwargs)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\cli\main.py", line 86, in main_subshell
        exit_code = do_call(args, p)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 93, in do_call
        return getattr(module, func_name)(args, parser)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\notices\core.py", line 72, in wrapper
        return_value = func(*args, **kwargs)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\cli\main_create.py", line 43, in execute
        install(args, parser, 'create')
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\cli\install.py", line 261, in install
        unlink_link_transaction = solver.solve_for_transaction(
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\solve.py", line 156, in solve_for_transaction
        unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\solve.py", line 199, in solve_for_diff
        final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\solve.py", line 304, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\common\io.py", line 86, in decorated
        return f(*args, **kwds)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\solve.py", line 467, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\solve.py", line 1061, in _prepare
        reduced_index = get_reduced_index(self.prefix, self.channels,
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\index.py", line 301, in get_reduced_index
        new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 137, in query_all
        result = tuple(concat(executor.map(subdir_query, channel_urls)))
      File "D:\Users\Hasee\anaconda3\lib\concurrent\futures\_base.py", line 609, in result_iterator
        yield fs.pop().result()
      File "D:\Users\Hasee\anaconda3\lib\concurrent\futures\_base.py", line 439, in result
        return self.__get_result()
      File "D:\Users\Hasee\anaconda3\lib\concurrent\futures\_base.py", line 391, in __get_result
        raise self._exception
      File "D:\Users\Hasee\anaconda3\lib\concurrent\futures\thread.py", line 58, in run
        result = self.fn(*self.args, **self.kwargs)
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 129, in <lambda>
        subdir_query = lambda url: tuple(SubdirData(Channel(url), repodata_fn=repodata_fn).query(
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 142, in query
        self.load()
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 207, in load
        _internal_state = self._load()
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 277, in _load
        raw_repodata_str = fetch_repodata_remote_request(
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 587, in fetch_repodata_remote_request
        raise UnavailableInvalidChannel(
      File "D:\Users\Hasee\anaconda3\lib\site-packages\conda\exceptions.py", line 464, in __init__
        body = response.json()
      File "D:\Users\Hasee\anaconda3\lib\site-packages\requests\models.py", line 975, in json
        raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

`$ D:\Users\Hasee\anaconda3\Scripts\conda-script.py create -n opencv123 python=3.7`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=D:\Users\Hasee\anaconda3\condabin\..\Scripts\conda.exe
               CONDA_EXES="D:\Users\Hasee\anaconda3\condabin\..\Scripts\conda.exe"
             CONDA_PREFIX=D:\Users\Hasee\anaconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=D:\Users\Hasee\anaconda3\python.exe
               CONDA_ROOT=D:\Users\Hasee\anaconda3
              CONDA_SHLVL=1
                CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6
           CURL_CA_BUNDLE=<not set>
     GENICAM_GENTL32_PATH=C:\Program Files (x86)\Basler\ToF\bin\Win32\
     GENICAM_GENTL64_PATH=C:\Program Files\Basler\ToF\bin\x64\
                 HOMEPATH=\Users\Hasee
          NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
                     PATH=D:\Users\Hasee\anaconda3;D:\Users\Hasee\anaconda3\Library\mingw-w64\bi
                          n;D:\Users\Hasee\anaconda3\Library\usr\bin;D:\Users\Hasee\anaconda3\Li
                          brary\bin;D:\Users\Hasee\anaconda3\Scripts;D:\Users\Hasee\anaconda3\bi
                          n;D:\Users\Hasee\anaconda3\condabin;C:\Program
                          Files\Basler\ToF\bin\x64;C:\Program Files
                          (x86)\Basler\ToF\bin\Win32;C:\Program Files\NVIDIA GPU Computing
                          Toolkit\CUDA\v11.6\bin;C:\Program Files\NVIDIA GPU Computing
                          Toolkit\CUDA\v11.6\libnvvp;C:\Program Files\Microsoft
                          MPI\Bin;C:\WINDOWS\System32\WindowsPowerShell\v1.0;D:\Program
                          Files(x86)\python安装\Scripts;D:\;rogram Files(x86)\python安装;C:\;INDOWS\
                          system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\OpenS
                          SH;C:\Program Files\Common Files\Autodesk Shared;C:\Program
                          Files\NVIDIA Corporation\Nsight Compute 2022.1.0;C:\Program Files
                          (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA
                          Corporation\NVIDIA NvDLISR;C:\Program
                          Files\Basler\ToF\bin\x64;C:\Program Files (x86)\Basler\ToF\bin\Win32;D
                          :\Users\Hasee\anaconda3;D:\Users\Hasee\anaconda3\Library\mingw-w64\bin
                          ;D:\Users\Hasee\anaconda3\Library\usr\bin;D:\Users\Hasee\anaconda3\Lib
                          rary\bin;D:\Users\Hasee\anaconda3\Scripts;C:\Users\Hasee\AppData\Local
                          \Microsoft\WindowsApps;D:\Program Files\Bandizip;D:\Program
                          Files\JetBrains\PyCharm 2020.1.1\bin;D:\Users\Hasee\Microsoft VS
                          Code\bin;D:\Program Files\Git\bin;.
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\Windows
                          PowerShell\v1.0\Modules
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : D:\Users\Hasee\anaconda3
            shell level : 1
       user config file : C:\Users\Hasee\.condarc
 populated config files : C:\Users\Hasee\.condarc
          conda version : 22.9.0
    conda-build version : 3.21.8
         python version : 3.9.12.final.0
       virtual packages : __cuda=11.6=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : D:\Users\Hasee\anaconda3  (writable)
      conda av data dir : D:\Users\Hasee\anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/noarch
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/win-64
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/noarch
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
          package cache : D:\Users\Hasee\anaconda3\pkgs
                          C:\Users\Hasee\.conda\pkgs
                          C:\Users\Hasee\AppData\Local\conda\conda\pkgs
       envs directories : D:\Users\Hasee\anaconda3\envs
                          C:\Users\Hasee\.conda\envs
                          C:\Users\Hasee\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/22.9.0 requests/2.28.1 CPython/3.9.12 Windows/10 Windows/10.0.19043
          administrator : False
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

If submitted, this report will be used by core maintainers to improve
future releases of conda.

二、解决方法:

conda config --remove-key channels

你可能感兴趣的:(python,深度学习,开发语言)