conda小白创建python虚拟环境报错WARNING conda.exceptions:print_unexpected_error_report(1216)

  • Post author:
  • Post category:python


创建虚拟环境时,写入

conda create -n test python=3.8.1报错


报错全文为

(base) C:\Users\Administrator>conda create -n test python=3.8.1

WARNING conda.exceptions:print_unexpected_error_report(1216): KeyError(‘pkgs_dirs’)

Traceback (most recent call last):

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\exceptions.py”, line 1082, in __call__

return func(*args, **kwargs)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\cli\main.py”, line 87, in _main

exit_code = do_call(args, p)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\cli\conda_argparse.py”, line 84, in do_call

return getattr(module, func_name)(args, parser)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\cli\main_create.py”, line 21, in execute

if is_conda_environment(context.target_prefix):

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 591, in target_prefix

return determine_target_prefix(self)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 1738, in determine_target_prefix

return locate_prefix_by_name(prefix_name)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 1681, in locate_prefix_by_name

envs_dirs = context.envs_dirs

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 517, in envs_dirs

return mockable_context_envs_dirs(self.root_writable, self.root_prefix, self._envs_dirs)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 91, in mockable_context_envs_dirs

fixed_dirs += join(user_data_dir(APP_NAME, APP_NAME), ‘envs’),

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\_vendor\appdirs.py”, line 67, in user_data_dir

path = os.path.join(_get_win_folder(const), appauthor, appname)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\_vendor\appdirs.py”, line 284, in _get_win_folder_with_pywin32

from win32com.shell import shellcon, shell

ImportError: DLL load failed while importing shell: 找不到指定的程序。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\exceptions.py”, line 1214, in print_unexpected_error_report

message_builder.append(get_main_info_str(error_report[‘conda_info’]))

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\cli\main_info.py”, line 237, in get_main_info_str

info_dict[‘_’ + key] = (‘\n’ + 26 * ‘ ‘).join(info_dict[key])

KeyError: ‘pkgs_dirs’

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

Traceback (most recent call last):

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\exceptions.py”, line 1082, in __call__

return func(*args, **kwargs)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\cli\main.py”, line 87, in _main

exit_code = do_call(args, p)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\cli\conda_argparse.py”, line 84, in do_call

return getattr(module, func_name)(args, parser)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\cli\main_create.py”, line 21, in execute

if is_conda_environment(context.target_prefix):

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 591, in target_prefix

return determine_target_prefix(self)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 1738, in determine_target_prefix

return locate_prefix_by_name(prefix_name)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 1681, in locate_prefix_by_name

envs_dirs = context.envs_dirs

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 517, in envs_dirs

return mockable_context_envs_dirs(self.root_writable, self.root_prefix, self._envs_dirs)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\base\context.py”, line 91, in mockable_context_envs_dirs

fixed_dirs += join(user_data_dir(APP_NAME, APP_NAME), ‘envs’),

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\_vendor\appdirs.py”, line 67, in user_data_dir

path = os.path.join(_get_win_folder(const), appauthor, appname)

File “C:\Users\Administrator\miniconda3\lib\site-packages\conda\_vendor\appdirs.py”, line 284, in _get_win_folder_with_pywin32

from win32com.shell import shellcon, shell

ImportError: DLL load failed while importing shell: 找不到指定的程序。

`$ C:\Users\Administrator\miniconda3\Scripts\conda-script.py create -n test python=3.8.1`

environment variables:

conda info could not be constructed.

KeyError(‘pkgs_dirs’)

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]: n

No report sent. To permanently opt-out, use

$ conda config –set report_errors false

(base) C:\Users\Administrator>

然后就是各种搜索。。。。。。。一个下午

最后看到


python gempy安装的坑 – 知乎


Windows conda ImportError: DLL load failed while importing shell_Ayka的博客-CSDN博客


python gempy安装的坑 – 知乎

里面讲了一个pywin32版本的问题

自己查cmd里面pip list ,pywin32版本301,重点conda里面conda list显示pywin32版本302。

然后降级conda里面的pywin32(pip install pywin32==301),与系统一致,完活。



版权声明:本文为weixin_47757103原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。