【问题标题】:ImportError: DLL Load failed while importing LeapPython: The Specified module could not be foundImportError:导入 LeapPython 时 DLL 加载失败:找不到指定的模块
【发布时间】:2021-11-08 02:51:38
【问题描述】:

一些背景:我目前正在做一个项目,以在 PyParrot Mambo 无人机和 Leap Motion 控制器之间进行通信。我遇到的问题是 Leap Motion 控制器软件只能在 python 2.7 中运行,而 PyParrot Mambo Drone 在 Python 3.9 中运行。我能够找到 Leap Motion 控制器软件与 Python 3.7 一起使用的绑定。当我尝试在 Python 3.9 中运行适用于 Python 3.7 的 Leap Motion 代码时出现错误。

Here 是用于在 Python 3.7 中运行 Leap Motion Controller 的绑定文件。从 python 3.9 中提供的文件夹运行 Sample.py 文件时出现以下错误:

(py39) C:\Users\Joginder Bassi\Downloads\LeapC-Python3.7>python Sample.py
Traceback (most recent call last):
  File "C:\Users\Joginder Bassi\Downloads\LeapC-Python3.7\Leap.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\anaconda\envs\py39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 565, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1108, in create_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
ImportError: DLL load failed while importing LeapPython: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Joginder Bassi\Downloads\LeapC-Python3.7\Sample.py", line 9, in <module>
    import Leap, sys, time
  File "C:\Users\Joginder Bassi\Downloads\LeapC-Python3.7\Leap.py", line 17, in <module>
    LeapPython = swig_import_helper()
  File "C:\Users\Joginder Bassi\Downloads\LeapC-Python3.7\Leap.py", line 16, in swig_import_helper
    return importlib.import_module('LeapPython')
  File "C:\anaconda\envs\py39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed while importing LeapPython: The specified module could not be found.

如果有人可以澄清在 python 3.7 到 3.9 之间进行了哪些更改会导致这些错误,并提供可能的修复以使 python 3.7 代码与 python 3.9 兼容。如果有一个适用于较新版本的 python 3 的 Leap Motion 软件绑定,那也会很有帮助。

【问题讨论】:

    标签: python python-3.x leap-motion drone.io


    【解决方案1】:

    绑定是使用未实现 Python Stable API 的 SWIG 生成的,因此您需要为每个 Python 版本重新构建绑定以使其与 Python 3.9 一起使用。

    这个guide 是为 Python 3.3.0 编写的,但应该有助于指导您为 Python 3.9 重建它的过程。

    【讨论】:

      猜你喜欢
      • 2020-05-15
      • 1970-01-01
      • 1970-01-01
      • 2022-10-22
      • 2020-07-01
      • 2021-03-04
      • 2021-09-16
      • 2020-07-11
      • 1970-01-01
      相关资源
      最近更新 更多