[Python] pyocd import error. (cannot load library, _native__lib.cp38-win32.pyd': error 0xc1

2022. 9. 27. 20:42프로젝트 로그/테스트x솔루션 JIG 개발기

반응형

문제

기존 아나콘다 32bit 환경에서 pyocd를 설치하고 사용하려고 하니 아래와 같은 에러가 발생 하였다.

기존 Python 환경

  • 아나콘다 32bit 설치

pyocd import error 발생 (_native__lib.cp38-win32.pyd를 load 할 수 없음)

OSError: cannot load library 'C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\cmsis_pack_manager\_native__lib.cp38-win32.pyd': error 0xc1

Type "help", "copyright", "credits" or "license" for more information.
>>> import pyocd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\anaconda3\lib\site-packages\pyocd\__init__.py", line 21, in <module>
    from . import gdbserver
  File "D:\anaconda3\lib\site-packages\pyocd\gdbserver\__init__.py", line 17, in <module>
    from .gdbserver import GDBServer
  File "D:\anaconda3\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 49, in <module>
    from ..commands.commander import ToolExitException
  File "D:\anaconda3\lib\site-packages\pyocd\commands\commander.py", line 25, in <module>
    from ..core.helpers import ConnectHelper
  File "D:\anaconda3\lib\site-packages\pyocd\core\helpers.py", line 26, in <module>
    from ..probe.aggregator import DebugProbeAggregator
  File "D:\anaconda3\lib\site-packages\pyocd\probe\aggregator.py", line 83, in <module>
    load_plugin_classes_of_type('pyocd.probe', PROBE_CLASSES, DebugProbe)
  File "D:\anaconda3\lib\site-packages\pyocd\core\plugin.py", line 97, in load_plugin_classes_of_type
    plugin = entry_point.load()()
  File "D:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2450, in load
    return self.resolve()
  File "D:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "D:\anaconda3\lib\site-packages\pyocd\probe\cmsis_dap_probe.py", line 28, in <module>
    from ..board.mbed_board import MbedBoard
  File "D:\anaconda3\lib\site-packages\pyocd\board\mbed_board.py", line 21, in <module>
    from .board import Board
  File "D:\anaconda3\lib\site-packages\pyocd\board\board.py", line 23, in <module>
    from ..target.pack import pack_target
  File "D:\anaconda3\lib\site-packages\pyocd\target\pack\pack_target.py", line 36, in <module>
    import cmsis_pack_manager
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\cmsis_pack_manager\__init__.py", line 25, in <module>
    from ._native import ffi, lib
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\cmsis_pack_manager\_native.py", line 7, in <module>
    lib = ffi.dlopen(os.path.join(os.path.dirname(__file__), '_native__lib.cp38-win32.pyd'), 0)
OSError: cannot load library 'C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\cmsis_pack_manager\_native__lib.cp38-win32.pyd': error 0xc1
>>>

 

 

해결 방법

해결 방법을 찾기 위해 구글링 하니, 아래와 같이 pyocd 라이브러리가 윈도우 환경에서 32bit Python에서는 문제가 있다고 한다.

PYD libraries can't be loaded in 32bit Python on Windows

https://github.com/pyocd/cmsis-pack-manager/issues/176

 

PYD libraries can't be loaded in 32bit Python on Windows · Issue #176 · pyocd/cmsis-pack-manager

Hello, In version 0.3.0 I'm getting the following error when starting 'pack-manager' (or more generally 'pyocd') OSError: cannot load library '...venv_39_32\lib\site-package...

github.com

 

위 글을 보고, 아나콘다를 64bit로 다시 설치 하니 문제 없이 동작 하였다.

 

 

반응형