赞
踩
在Anaconda Prompt (anaconda3)
中使用conda create
命令新建环境报错如下:
(base) D:\OneDrive\桌面>conda create -n my_env python==3.8
Collecting package metadata (current_repodata.json): failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "D:\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 259, in _load
raw_repodata_str = fetch_repodata_remote_request(
File "D:\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 613, in fetch_repodata_remote_request
raise Response304ContentUnchanged()
conda.core.subdir_data.Response304ContentUnchanged
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\anaconda3\lib\site-packages\conda\exceptions.py", line 1079, in __call__
return func(*args, **kwargs)
File "D:\anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
exit_code = do_call(args, p)
File "D:\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 83, in do_call
return getattr(module, func_name)(args, parser)
File "D:\anaconda3\lib\site-packages\conda\cli\main_create.py", line 41, in execute
install(args, parser, 'create')
File "D:\anaconda3\lib\site-packages\conda\cli\install.py", line 261, in install
unlink_link_transaction = solver.solve_for_transaction(
File "D:\anaconda3\lib\site-packages\conda\core\solve.py", line 114, in solve_for_transaction
unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
File "D:\anaconda3\lib\site-packages\conda\core\solve.py", line 157, in solve_for_diff
final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
File "D:\anaconda3\lib\site-packages\conda\core\solve.py", line 262, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "D:\anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated
return f(*args, **kwds)
File "D:\anaconda3\lib\site-packages\conda\core\solve.py", line 425, in _collect_all_metadata
index, r = self._prepare(prepared_specs)
File "D:\anaconda3\lib\site-packages\conda\core\solve.py", line 1020, in _prepare
reduced_index = get_reduced_index(self.prefix, self.channels,
File "D:\anaconda3\lib\site-packages\conda\core\index.py", line 276, in get_reduced_index
new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
File "D:\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 120, in query_all
result = tuple(concat(executor.map(subdir_query, channel_urls)))
File "D:\anaconda3\lib\concurrent\futures\_base.py", line 611, in result_iterator
yield fs.pop().result()
File "D:\anaconda3\lib\concurrent\futures\_base.py", line 432, in result
return self.__get_result()
File "D:\anaconda3\lib\concurrent\futures\_base.py", line 388, in __get_result
raise self._exception
File "D:\anaconda3\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "D:\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 112, in <lambda>
subdir_query = lambda url: tuple(SubdirData(Channel(url), repodata_fn=repodata_fn).query(
File "D:\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 125, in query
self.load()
File "D:\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 189, in load
_internal_state = self._load()
File "D:\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 277, in _load
_internal_state = self._read_local_repdata(mod_etag_headers.get('_etag'),
File "D:\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 326, in _read_local_repdata
_internal_state = self._process_raw_repodata_str(raw_repodata_str)
File "D:\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 364, in _process_raw_repodata_str
json_obj = json.loads(raw_repodata_str or '{}')
File "D:\anaconda3\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "D:\anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\anaconda3\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 420202 column 26 (char 12681108)
`$ D:\anaconda3\Scripts\conda-script.py create -n my_env python==3.8`
environment variables:
CIO_TEST=<not set>
CLASSPATH=.;D:\Programming Environment\Java\java_8\lib\dt.jar;D:\Programming
Environment\Java\java_8\lib\tools.jar;
CONDA_DEFAULT_ENV=base
CONDA_EXE=D:\anaconda3\condabin\..\Scripts\conda.exe
CONDA_EXES="D:\anaconda3\condabin\..\Scripts\conda.exe"
CONDA_PREFIX=D:\Anaconda3
CONDA_PROMPT_MODIFIER=(base)
CONDA_PYTHON_EXE=D:\anaconda3\python.exe
CONDA_ROOT=D:\anaconda3
CONDA_SHLVL=1
CUDA_PATH=D:\Mx-yolov3\CUDAv10.0
CURL_CA_BUNDLE=<not set>
HOMEPATH=\Users\MSTIFIY
NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
PATH=D:\anaconda3;D:\anaconda3\Library\mingw-w64\bin;D:\anaconda3\Library\u
sr\bin;D:\anaconda3\Library\bin;D:\anaconda3\Scripts;D:\anaconda3\bin;
D:\Anaconda3;D:\Anaconda3\Library\mingw-w64\bin;D:\Anaconda3\Library\u
sr\bin;D:\Anaconda3\Library\bin;D:\Anaconda3\Scripts;D:\Anaconda3\bin;
D:\anaconda3\condabin;D:\Mx-yolov3\CUDAv10.0\bin;D:\Mx-yolov3\CUDAv10.
0\libnvvp;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS;C:\WINDOWS\sy
stem32;C:\WINDOWS\System32;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System3
2\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;D:\Lauguage
Studing\PythonSpider;C:\Program Files
(x86)\Google\Chrome\Application\chromedriver;D:\Programming
Environment\Java\java_8;D:\Lauguage
Studing\Android\Git\Git\cmd;D:\Programming Environment\Tesseract-
OCR;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance
Toolkit;C:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA
NvDLISR;D:\Lauguage Studing\Matlab\runtime\win64;D:\Lauguage
Studing\Matlab\bin;D:\Lauguage
Studing\Matlab\polyspace\bin;D:\Lauguage
Studing\opencv3.4.0\opencv\build\x64\vc14\bin;D:\Lauguage Studing\rasp
berry\putty;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:
\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;D
:\anaconda3\envs\Mx_yolov3\Scripts;D:\anaconda3\envs\Mx_yolov3;D:\Andr
oidSDK;\platform-tools;D:\AndroidSDK;\tools;D:\Tools\cmake-3.21.2-wind
ows-x86_64\bin;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32;C:\W
INDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WIN
DOWS\System32\OpenSSH;D:\Programming
Environment\python;D:\Fiddler;D:\Lauguage Studing\鐖櫕\PyCharm
Community Edition 2019.3.1\bin;.;D:\Programming
Environment\python\Scripts;C:\Program Files
(x86)\Google\Chrome\Application;D:\Programming
Environment\Java\java_8\bin;D:\Programming
Environment\Java\java_8\jre\bin;"D:\Programming
Environment\Java\java_8\bin;D:\Mx-yolov3\CUDAv10.0\bin;D:\Mx-yolov3\CU
DAv10.0\libnvvp;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS;C:\WIND
OWS\system32;C:\WINDOWS\System32;C:\WINDOWS\System32\Wbem;C:\WINDOWS\S
ystem32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;D:\Lauguage
Studing\PythonSpider;C:\Program Files
(x86)\Google\Chrome\Application\chromedriver;D:\Programming
Environment\Java\java_8;D:\Lauguage
Studing\Android\Git\Git\cmd;D:\Programming Environment\Tesseract-
OCR;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance
Toolkit;C:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA
NvDLISR;D:\Lauguage Studing\Matlab\runtime\win64;D:\Lauguage
Studing\Matlab\bin;D:\Lauguage
Studing\Matlab\polyspace\bin;D:\Lauguage
Studing\opencv3.4.0\opencv\build\x64\vc14\bin;D:\Lauguage Studing\rasp
berry\putty;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:
\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;D
:\anaconda3\envs\Mx_yolov3\Scripts;D:\anaconda3\envs\Mx_yolov3;D:\Andr
oidSDK;\platform-tools;D:\AndroidSDK;\tools;D:\Tools\cmake-3.21.2-wind
ows-x86_64\bin;";"D:\AndroidSDK;\platform-
tools;D:\AndroidSDK;\tools鈥嬧€嬧€嬧€嬧€嬧€嬧€?;D:\Programming
Environment\Tesseract-OCR;D:\anaconda3;C:\Users\MSTIFIY\AppData\Local\
Microsoft\WindowsApps;D:\Lauguage Studing\miktex\MiKTeX\miktex\bin\x64
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:\Anaconda3
shell level : 1
user config file : C:\Users\MSTIFIY\.condarc
populated config files : C:\Users\MSTIFIY\.condarc
conda version : 4.9.2
conda-build version : 3.18.11
python version : 3.8.3.final.0
virtual packages : __cuda=10.2=0
__win=0=0
__archspec=1=x86_64
base environment : D:\anaconda3 (writable)
channel URLs : https://mirrors.ustc.edu.cn/anaconda/pkgs/main/win-64
https://mirrors.ustc.edu.cn/anaconda/pkgs/main/noarch
https://mirrors.ustc.edu.cn/anaconda/pkgs/free/win-64
https://mirrors.ustc.edu.cn/anaconda/pkgs/free/noarch
https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/win-64
https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/noarch
package cache : D:\anaconda3\pkgs
C:\Users\MSTIFIY\.conda\pkgs
C:\Users\MSTIFIY\AppData\Local\conda\conda\pkgs
envs directories : D:\anaconda3\envs
C:\Users\MSTIFIY\.conda\envs
C:\Users\MSTIFIY\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.9.2 requests/2.24.0 CPython/3.8.3 Windows/10 Windows/10.0.19041
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.
Would you like conda to send this report to the core maintainers?
[y/N]:
channels:
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
ssl_verify: true
channels:
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
ssl_verify: true
An unexpected error has occurred. Conda has prepared the above report.
Upload did not complete.
具体如下:
`$ D:\Software\Anaconda3\Path\Scripts\conda-script.py create -n PRE`
environment variables:
CIO_TEST=<not set>
CONDA_DEFAULT_ENV=base
CONDA_EXE=D:\Software\Anaconda3\Path\condabin\..\Scripts\conda.exe
CONDA_EXES="D:\Software\Anaconda3\Path\condabin\..\Scripts\conda.exe"
CONDA_PREFIX=D:\Software\Anaconda3\Path
CONDA_PROMPT_MODIFIER=(base)
CONDA_PYTHON_EXE=D:\Software\Anaconda3\Path\python.exe
CONDA_ROOT=D:\Software\Anaconda3\Path
CONDA_SHLVL=1
CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0
CURL_CA_BUNDLE=<not set>
HOMEPATH=\Users\Camila
MOZ_PLUGIN_PATH=D:\Software\Foxit\Path\Foxit PDF Reader\plugins\
NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
PATH=D:\Software\Anaconda3\Path;D:\Software\Anaconda3\Path\Library\mingw-w6
4\bin;D:\Software\Anaconda3\Path\Library\usr\bin;D:\Software\Anaconda3
\Path\Library\bin;D:\Software\Anaconda3\Path\Scripts;D:\Software\Anaco
nda3\Path\bin;D:\Software\Anaconda3\Path;D:\Software\Anaconda3\Path\Li
brary\mingw-w64\bin;D:\Software\Anaconda3\Path\Library\usr\bin;D:\Soft
ware\Anaconda3\Path\Library\bin;D:\Software\Anaconda3\Path\Scripts;D:\
Software\Anaconda3\Path\bin;D:\Software\Anaconda3\Path\condabin;C:\Pro
gram Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin;C:\Program
Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\libnvvp;C:\Windows\syste
m32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPow
erShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\NVIDIA
Corporation\Nsight Compute 2020.1.1;C:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;D:\Software\Matlab
R2017b\path\runtime\win64;D:\Software\Matlab R2017b\path\bin;C:\Users\
Camila\AppData\Local\Microsoft\WindowsApps;.;D:\Software\Pycharm-2021\
Path\PyCharm 2021.1\bin;.;C:\Program Files\Bandizip
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:\Software\Anaconda3\Path
shell level : 1
user config file : C:\Users\Camila\.condarc
populated config files : C:\Users\Camila\.condarc
conda version : 4.10.1
conda-build version : 3.21.4
python version : 3.8.8.final.0
virtual packages : __cuda=11.2=0
__win=0=0
__archspec=1=x86_64
base environment : D:\Software\Anaconda3\Path (writable)
conda av data dir : D:\Software\Anaconda3\Path\etc\conda
conda av metadata url : https://repo.anaconda.com/pkgs/main
channel URLs : https://conda.anaconda.org/conda-forge/win-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/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
package cache : D:\Software\Anaconda3\Path\pkgs
C:\Users\Camila\.conda\pkgs
C:\Users\Camila\AppData\Local\conda\conda\pkgs
envs directories : D:\Software\Anaconda3\Path\envs
C:\Users\Camila\.conda\envs
C:\Users\Camila\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.10.1 requests/2.25.1 CPython/3.8.8 Windows/10 Windows/10.0.19041
administrator : False
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
Upload did not complete.
由于之前改BUG需要升级conda,然后惊讶的发现conda没法升级,conda update conda之后会提示出错an unexpected error has occurred. conda has prepared the above report. Upload did not complete.
后续导致我创建虚拟环境报错,于是查找相关解决方案解决问题。
网友提供较多的方案。仅供参考,本人是第三种情况,同样解决了。
这个文件位置一般为C:\User\Administrator.condarc,如果设置了清华/中科大源,里面会保存这些镜像源的地址,删除了这个文件其实就是类似于恢复使用官方源。
删除conda中的缓存索引,运行如下命令:
conda clean -i
但是!!!
我使用第1、2种解决方案均无效,然后在网上看到UU们给出了一条建议:
try close your VPN
发现了自己最大问题在于使用了外网,关闭后,问题得以解决。特此记录!!!
我原来的环境是tensorflow1.5,后来升级到tensorflow2.1,却发现原来写的一些代码不能在tensorflow 2.0以上运行,要改代码的话确实涉及到一些底层的API,对我来说难度不小,于是想再创建一个环境tensorflow1.5,让这些老代码就在1.5版本的tensorflow下运行。于是进入到anaconda prompt命令行进行操作:conda create -n tensorflow1.5,于是就报出如下错误了:
Traceback (most recent call last):
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 227, in _load
mod_etag_headers.get('_mod'))
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 574, in fetch_repodata_remote_request
raise Response304ContentUnchanged()
conda.core.subdir_data.Response304ContentUnchanged
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\DEV\Anaconda3\lib\site-packages\conda\exceptions.py", line 819, in __call__
return func(*args, **kwargs)
File "C:\DEV\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main
exit_code = do_call(args, p)
File "C:\DEV\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 77, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "C:\DEV\Anaconda3\lib\site-packages\conda\cli\main_create.py", line 11, in execute
install(args, parser, 'create')
File "C:\DEV\Anaconda3\lib\site-packages\conda\cli\install.py", line 235, in install
force_reinstall=context.force,
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\solve.py", line 518, in solve_for_transaction
force_remove, force_reinstall)
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\solve.py", line 451, in solve_for_diff
final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove)
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\solve.py", line 180, in solve_final_state
index, r = self._prepare(prepared_specs)
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\solve.py", line 592, in _prepare
self.subdirs, prepared_specs)
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\index.py", line 215, in get_reduced_index
new_records = query_all(spec)
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\index.py", line 184, in query_all
return tuple(concat(future.result() for future in as_completed(futures)))
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 95, in query
self.load()
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 149, in load
_internal_state = self._load()
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 233, in _load
mod_etag_headers.get('_mod'))
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 280, in _read_local_repdata
_internal_state = self._process_raw_repodata_str(raw_repodata_str)
File "C:\DEV\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 317, in _process_raw_repodata_str
json_obj = json.loads(raw_repodata_str or '{}')
File "C:\DEV\Anaconda3\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\DEV\Anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\DEV\Anaconda3\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 169024 column 26 (char 4767569)
于是我就开始苦逼的在网上搜索(吐槽一下百度,搜索不到合适的结果,还是在google上搜索了大量的同样问题),我发现很多人遇到了类似的或相同的问题,可是却没有解决的好方法,直到我读到https://github.com/conda/conda/issues/8051,感谢EricThomson。
conda config --get channels
我的电脑上运行结果是:
--add channels 'defaults' # lowest priority
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge'
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2'
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/'
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r'
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free'
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main' # highest priority
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
问题圆满解决,我开始愉快地创建新的环境了。
我很奇怪为啥我前一个月用conda成功创建了环境,过了一个月就不能创建环境了呢?我想了想,也许是我在升级安装tensorflow2.1时使用了清华的镜像源,所以我的channels就默认到清华的镜像了,而正好镜像上的conda-forge引起我的错误。这些都是猜测,没有得到验证,有知道的朋友请不吝赐教。
出现错误情况:
今天在使用Anaconda激活python3.6环境的时候出现了如下错误:
[zsq@localhost ~]$ conda activate python36
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
google一番发现了几个解决办法,但是还是没能成功解决。后面仔细想想,发现是上次ssh连接该服务器使用conda activate python36命令激活环境后未使用conda deactivate退出环境就关闭终端导致的。
发现这个问题后,解决思路就比较明显了,重新激活一下环境就好了,具体操作如下:
# 重新进入虚拟环境
source activate
# 退出虚拟环境
conda deactivate
最后,重新执行conda activate python36,没有报错,成功进入该虚拟环境。
# 修改源为清华大学软件镜像站
# 编辑配置文件
vim ~/.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
# 使得当前配置生效
source ~/.condarc
# 安装pytorch
# cuda 8.x
conda install pytorch torchvision cudatoolkit=8.0 -c pytorch
# cuda 9.0
conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
# cuda 10.0
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
# 测试是否安装成功
import torch
import torchvision
# 若正常则返回 tensor(1., device='cuda:0')
a = torch.tensor(1.)
a.cuda()
# 若正常则静默
from torch.backends import cudnn
# 若正常则返回 True
cudnn.is_available()
# 若正常则返回 True
cudnn.is_acceptable(a.cuda())
借用一下别人的问题图片,我的问题大致差不多,激活conda虚拟环境时候报错
查看系统环境变量Path,发现报错目录所在的python路径错误,删除之后激活环境正常。
表达式或语句中包含意外的标记“D:\MXNet\lib”。
所在位置 行:1 字符: 2386
+ ... 3\common\lib\x64;"D:\MXNet\lib;";"D:\MXNet\3rdparty\cudnn\bin;";"D:\M ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
表达式或语句中包含意外的标记“D:\MXNet\3rdparty\cudnn\bin”。
所在位置 行:1 字符: 2417
+ ... ib;";"D:\MXNet\3rdparty\cudnn\bin;";"D:\MXNet\3rdparty\cudart;";"D:\M ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
表达式或语句中包含意外的标记“D:\MXNet\3rdparty\cudart”。
所在位置 行:1 字符: 2445
+ ... n\bin;";"D:\MXNet\3rdparty\cudart;";"D:\MXNet\3rdparty\opencv;";"D:\M ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
表达式或语句中包含意外的标记“D:\MXNet\3rdparty\opencv”。
所在位置 行:1 字符: 2473
+ ... ty\cudart;";"D:\MXNet\3rdparty\opencv;";"D:\MXNet\3rdparty\vc;";"D:\M ...
+ ~~~~~~~~~~~~~~~~~~~~
表达式或语句中包含意外的标记“D:\MXNet\3rdparty\vc”。
所在位置 行:1 字符: 2497
+ ... ty\opencv;";"D:\MXNet\3rdparty\vc;";"D:\MXNet\3rdparty\gnuwin;";"D:\M ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
表达式或语句中包含意外的标记“D:\MXNet\3rdparty\gnuwin”。
所在位置 行:1 字符: 2525
+ ... ";"D:\MXNet\3rdparty\gnuwin;";"D:\MXNet\3rdparty\openblas\bin;";F:\en ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
表达式或语句中包含意外的标记“D:\MXNet\3rdparty\openblas\bin”。
所在位置 D:\ProgramData\Anaconda3\shell\condabin\Conda.psm1:107 字符: 9
+ Invoke-Expression -Command $activateCommand;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Invoke-Expression], ParseException
+ FullyQualifiedErrorId : UnexpectedToken,Microsoft.PowerShell.Commands.InvokeExpressionCommand
Conda.psm1 中没能获取正确的环境变量(多了引号,导致错误,有点类似 XSS 的感觉)
把系统环境变量 path 中多个路径挤在一起写的分开写,删除某些结尾包含 ; 的行
还有可能是用户自定义了系统变量,并通过 %xxx% (比如我的是 %JAVA_HOME% )引入,也会报相同的错
修改好后再次运行就会成功
互联网的意义在于高质量的共享
创建新的Anaconda虚拟环境时
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required 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.
Would you like conda to send this report to the core maintainers? [y/N]: y
Upload successful.to
download and install packages.
.condarc文件未删除
(1)在
Anaconda Prompt界面下,输入以下命令:
conda config --show-sources
(2) 检查是否存在.condarc文件
(3)图片显示存在.condarc文件,这里为地址,删除即可:
(4)重新创建Anaconda环境
大功告成!
PS:若安装失败,可能需要关掉梯子
今天在用anaconda创建新的python环境时,报了An unexpected error has occurred. Conda has prepared the above report
,在这里记录一下解决方法。
报错截图
conda config --show-sources
如果输出如下图所示的信息,说明.condarc文件已经存在:
然后重新执行conda新建环境的命令就行:
conda create -n 环境名 python=python版本
另外,还有一种可能是梯子的问题,把梯子关掉就好了。
请问楼主这个是什么报错呀,该如何解决呢
A:哎,是pycharm2023的问题好像,更新以后的bug,动态conda检测好像不太行,只有conda的base库可以,自创库就检测不到(但能用,就是报错很烦人)
A:是pycharm2023版本的问题,我退回了21和22版就行了
conda create新建环境失败报错:An unexpected error has occurred. Conda has prepared the above report.
创造虚拟环境报错An unexpected error has occurred. Conda has prepared the above report.解决方案
conda create, conda install, conda update报错conda.core.subdir_data.Response304ContentUnchanged
conda激活虚拟环境报错 Invoke-Expression 记录
conda activate 报 Invoke-Expression
[报错解决]Anacon创建新虚拟环境失败:An unexpected error has occurred. Conda has prepared the above report.
[conda报错 已解决]An unexpected error has occurred. Conda has prepared the above report.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。