一些上下文:我目前正在进行一个项目,在PyParrot Mambo无人机和Leap Motion Controller之间进行通信。我遇到的问题是,Leap运动控制器软件只能在python 2.7中工作,而PyParrot Mambo Drone只能在python 3.9中工作。我找到了Leap Motion Controller软件与Python 3.7的绑定。当我试图在Python 3.9中运行适用于Python 3.7的Leap Motion代码时,我遇到了一个错误。
以下是用于在Python 3.7中运行the Leap Motion Controller的绑定文件。当我从python 3.9中提供的文件夹运行Sample.py文件时,我得到了以下错误:
(py39) C:UsersJoginder BassiDownloadsLeapC-Python3.7>python Sample.py
Traceback (most recent call last):
File "C:UsersJoginder BassiDownloadsLeapC-Python3.7Leap.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:anacondaenvspy39libimportlib__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:UsersJoginder BassiDownloadsLeapC-Python3.7Sample.py", line 9, in <module>
import Leap, sys, time
File "C:UsersJoginder BassiDownloadsLeapC-Python3.7Leap.py", line 17, in <module>
LeapPython = swig_import_helper()
File "C:UsersJoginder BassiDownloadsLeapC-Python3.7Leap.py", line 16, in swig_import_helper
return importlib.import_module('LeapPython')
File "C:anacondaenvspy39libimportlib__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软件绑定,那也会很有帮助。
绑定是用SWIG生成的,SWIG不实现Python Stable API,因此您需要为每个Python版本重新构建绑定,以便与Python 3.9一起使用。
本指南是为Python 3.3.0编写的,但应该有助于指导您为Python 3.9重新构建它。
我发现可以在这个GitHub repo中使用Python 3.9绑定(seanschneewiss/RoSeMotion(。我已经在我的项目中测试过了,它似乎运行得很好。还有3.6、3.7、3.8的绑定。