Anaconda中使用conda创建新环境失败
电脑系统:win 10
环境:Anaconda
创建方法:使用conda来创建环境
创建失败提醒:
(base) C:\Users\Ruixue_Time>conda create -n vilg python=3.8
Collecting package metadata (current_repodata.json): failed# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<Traceback (most recent call last):File "D:\program\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 531, in fetch_repodata_remote_requestresp.raise_for_status()File "D:\program\Anaconda\lib\site-packages\requests\models.py", line 1021, in raise_for_statusraise HTTPError(http_error_msg, response=self)requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch/current_repodata.jsonDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "D:\program\Anaconda\lib\site-packages\requests\models.py", line 971, in jsonreturn complexjson.loads(self.text, **kwargs)File "D:\program\Anaconda\lib\site-packages\simplejson\__init__.py", line 514, in loadsreturn _default_decoder.decode(s)File "D:\program\Anaconda\lib\site-packages\simplejson\decoder.py", line 386, in decodeobj, end = self.raw_decode(s)File "D:\program\Anaconda\lib\site-packages\simplejson\decoder.py", line 416, in raw_decodereturn 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:\program\Anaconda\lib\site-packages\conda\exceptions.py", line 1129, in __call__return func(*args, **kwargs)File "D:\program\Anaconda\lib\site-packages\conda\cli\main.py", line 86, in main_subshellexit_code = do_call(args, p)File "D:\program\Anaconda\lib\site-packages\conda\cli\conda_argparse.py", line 93, in do_callreturn getattr(module, func_name)(args, parser)File "D:\program\Anaconda\lib\site-packages\conda\notices\core.py", line 72, in wrapperreturn_value = func(*args, **kwargs)File "D:\program\Anaconda\lib\site-packages\conda\cli\main_create.py", line 43, in executeinstall(args, parser, 'create')File "D:\program\Anaconda\lib\site-packages\conda\cli\install.py", line 261, in installunlink_link_transaction = solver.solve_for_transaction(File "D:\program\Anaconda\lib\site-packages\conda\core\solve.py", line 156, in solve_for_transactionunlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,File "D:\program\Anaconda\lib\site-packages\conda\core\solve.py", line 199, in solve_for_difffinal_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,File "D:\program\Anaconda\lib\site-packages\conda\core\solve.py", line 304, in solve_final_statessc = self._collect_all_metadata(ssc)File "D:\program\Anaconda\lib\site-packages\conda\common\io.py", line 86, in decoratedreturn f(*args, **kwds)File "D:\program\Anaconda\lib\site-packages\conda\core\solve.py", line 467, in _collect_all_metadataindex, r = self._prepare(prepared_specs)File "D:\program\Anaconda\lib\site-packages\conda\core\solve.py", line 1061, in _preparereduced_index = get_reduced_index(self.prefix, self.channels,File "D:\program\Anaconda\lib\site-packages\conda\core\index.py", line 301, in get_reduced_indexnew_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,File "D:\program\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 137, in query_allresult = tuple(concat(executor.map(subdir_query, channel_urls)))File "D:\program\Anaconda\lib\concurrent\futures\_base.py", line 609, in result_iteratoryield fs.pop().result()File "D:\program\Anaconda\lib\concurrent\futures\_base.py", line 439, in resultreturn self.__get_result()File "D:\program\Anaconda\lib\concurrent\futures\_base.py", line 391, in __get_resultraise self._exceptionFile "D:\program\Anaconda\lib\concurrent\futures\thread.py", line 58, in runresult = self.fn(*self.args, **self.kwargs)File "D:\program\Anaconda\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:\program\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 142, in queryself.load()File "D:\program\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 207, in load_internal_state = self._load()File "D:\program\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 277, in _loadraw_repodata_str = fetch_repodata_remote_request(File "D:\program\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 587, in fetch_repodata_remote_requestraise UnavailableInvalidChannel(File "D:\program\Anaconda\lib\site-packages\conda\exceptions.py", line 464, in __init__body = response.json()File "D:\program\Anaconda\lib\site-packages\requests\models.py", line 975, in jsonraise RequestsJSONDecodeError(e.msg, e.doc, e.pos)requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)`$ D:\program\Anaconda\Scripts\conda-script.py create -n vilg python=3.8`environment variables:CIO_TEST=<not set>CONDA_DEFAULT_ENV=baseCONDA_EXE=D:\program\Anaconda\condabin\..\Scripts\conda.exeCONDA_EXES="D:\program\Anaconda\condabin\..\Scripts\conda.exe"CONDA_PREFIX=D:\program\AnacondaCONDA_PROMPT_MODIFIER=(base)CONDA_PYTHON_EXE=D:\program\Anaconda\python.exeCONDA_ROOT=D:\program\AnacondaCONDA_SHLVL=1CURL_CA_BUNDLE=<not set>HOMEPATH=\Users\Ruixue_TimePATH=D:\program\Anaconda;D:\program\Anaconda\Library\mingw-w64\bin;D:\program\Anaconda\Library\usr\bin;D:\program\Anaconda\Library\bin;D:\program\Anaconda\Scripts;D:\program\Anaconda\bin;D:\program\Anaconda\condabin;D:\program\java8\bin;D:\program\Java1.8\bin;D:\program\Java1.8;D:\program\java8;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\program\VMware16\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\windows\System32\OpenSSH;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramFiles\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\ProgramFiles (x86)\Microsoft SQL Server\150\Tools\Binn;C:\ProgramFiles\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\MicrosoftSQL Server\150\DTS\Binn;C:\Program Files (x86)\WindowsKits\8.1\Windows Performance Toolkit;C:\Program Files\dotnet;D:\program\Anaconda;D:\program\Anaconda\Scripts;D:\program\Anaconda\Library\bin;C:\Program Files (x86)\Microsoft SQL Server\160\Tools\Binn;C:\ProgramFiles\Microsoft SQL Server\160\Tools\Binn;C:\Program Files\MicrosoftSQL Server\160\DTS\Binn;D:\program\MySQL5.5\bin;D:\program\TortoiseSVN\bin;D:\program\MATLAB\R2022b\runtime\win64;D:\program\MATLAB\R2022b\bin;C:\Users\Ruixue_Time\AppData\Local\Microsoft\WindowsApps;.;D:\program\Pycharm2023\PyCharm Community Edition2023.3.2\bin;.;D:\program\IntelliJ_IDEA\IntelliJ IDEA 2024.1\bin;.PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft SQLServer\150\Tools\PowerShell\Modules\;C:\Program Files (x86)\MicrosoftSQL Server\160\Tools\PowerShell\Modules\REQUESTS_CA_BUNDLE=<not set>SSL_CERT_FILE=<not set>active environment : baseactive env location : D:\program\Anacondashell level : 1user config file : C:\Users\Ruixue_Time\.condarcpopulated config files : C:\Users\Ruixue_Time\.condarcconda version : 22.9.0conda-build version : 3.22.0python version : 3.9.13.final.0virtual packages : __cuda=12.6=0__win=0=0__archspec=1=x86_64base environment : D:\program\Anaconda (writable)conda av data dir : D:\program\Anaconda\etc\condaconda av metadata url : Nonechannel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarchhttps://repo.anaconda.com/pkgs/main/win-64https://repo.anaconda.com/pkgs/main/noarchhttps://repo.anaconda.com/pkgs/r/win-64https://repo.anaconda.com/pkgs/r/noarchhttps://repo.anaconda.com/pkgs/msys2/win-64https://repo.anaconda.com/pkgs/msys2/noarchpackage cache : D:\program\Anaconda\pkgsC:\Users\Ruixue_Time\.conda\pkgsC:\Users\Ruixue_Time\AppData\Local\conda\conda\pkgsenvs directories : D:\program\Anaconda\envsC:\Users\Ruixue_Time\.conda\envsC:\Users\Ruixue_Time\AppData\Local\conda\conda\envsplatform : win-64user-agent : conda/22.9.0 requests/2.28.1 CPython/3.9.13 Windows/10 Windows/10.0.19045administrator : Falsenetrc file : Noneoffline mode : FalseAn unexpected error has occurred. Conda has prepared the above report.Upload did not complete.
解决办法
步骤一
输入conda config --show-sources,查看是否有 .condarc文件
(base) C:\Users\Ruixue_Time>conda config --show-sources
==> C:\Users\Ruixue_Time\.condarc <==
channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/- defaults
show_channel_urls: True
report_errors: False
之后会显示这个文件的路径和文件内容
步骤二
删除.condarc文件
步骤三
继续创新自己的新环境,就可以啦
参考文章
参考博文