본문 바로가기
Language&Framework&Etc/Python

from win32com.shell import shellcon, shell ImportError: DLL load failed while importing shell: 지정된 프로시저를 찾을 수 없습니다.

by 머리올리자 2022. 7. 19.

 

(base) C:\Windows\system32>conda create -n tf12 python=3.8
WARNING conda.exceptions:print_unexpected_error_report(1216): KeyError('pkgs_dirs')
Traceback (most recent call last):
  File "C:\Users\choi\anaconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__
    return func(*args, **kwargs)
  File "C:\Users\choi\anaconda3\lib\site-packages\conda\cli\main.py", line 87, in _main
    exit_code = do_call(args, p)
  File "C:\Users\choi\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 84, in do_call
    return getattr(module, func_name)(args, parser)
  File "C:\Users\choi\anaconda3\lib\site-packages\conda\cli\main_create.py", line 21, in execute
    if is_conda_environment(context.target_prefix):
  File "C:\Users\choi\anaconda3\lib\site-packages\conda\base\context.py", line 591, in target_prefix
    return determine_target_prefix(self)
  File "C:\Users\choi\anaconda3\lib\site-packages\conda\base\context.py", line 1738, in determine_target_prefix
    return locate_prefix_by_name(prefix_name)
  File "C:\Users\choi\anaconda3\lib\site-packages\conda\base\context.py", line 1681, in locate_prefix_by_name
    envs_dirs = context.envs_dirs
  File "C:\Users\choi\anaconda3\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\choi\anaconda3\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\choi\anaconda3\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\choi\anaconda3\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\choi\anaconda3\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\choi\anaconda3\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\choi\anaconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__
        return func(*args, **kwargs)
      File "C:\Users\choi\anaconda3\lib\site-packages\conda\cli\main.py", line 87, in _main
        exit_code = do_call(args, p)
      File "C:\Users\choi\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 84, in do_call
        return getattr(module, func_name)(args, parser)
      File "C:\Users\choi\anaconda3\lib\site-packages\conda\cli\main_create.py", line 21, in execute
        if is_conda_environment(context.target_prefix):
      File "C:\Users\choi\anaconda3\lib\site-packages\conda\base\context.py", line 591, in target_prefix
        return determine_target_prefix(self)
      File "C:\Users\choi\anaconda3\lib\site-packages\conda\base\context.py", line 1738, in determine_target_prefix
        return locate_prefix_by_name(prefix_name)
      File "C:\Users\choi\anaconda3\lib\site-packages\conda\base\context.py", line 1681, in locate_prefix_by_name
        envs_dirs = context.envs_dirs
      File "C:\Users\choi\anaconda3\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\choi\anaconda3\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\choi\anaconda3\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\choi\anaconda3\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\choi\anaconda3\Scripts\conda-script.py create -n tf12 python=3.8`

  environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')

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

Upload did not complete.

(base) C:\Windows\system32>python pywin32_postinstall.py -install
python: can't open file 'C:\Windows\system32\pywin32_postinstall.py': [Errno 2] No such file or directory

최근 아나콘다를 설치 후 환경을 만드는데 위와 같은 에러가 떠서 여러 방법을 시도해보았는데,

나의 경우는  아래 방법으로 해결했다.

 

https://stackoverflow.com/questions/58612306/how-to-fix-importerror-dll-load-failed-while-importing-win32api

 

How to fix "ImportError: DLL load failed" while importing win32api

I'm setting up an autoclicker in Python 3.8 and I need win32api for GetAsyncKeyState but it always gives me this error: >>> import win32api Traceback (most recent call last): File "...

stackoverflow.com

pip install --upgrade pywin32==225