References

official lib sdk contains the right files; see: https://gist.github.com/i3games/20232baf5a6ef13131fcf72d63869113 Need files:

  • libLeap.dylib
  • LeapPython.so
  • Leap.py

https://github.com/shadowmint/python-leap-ctypes https://developer-archive.leapmotion.com/documentation/python/devguide/Sample_Tutorial.html?proglang=python https://github.com/openleap/leapong

building leap python lib for python3

https://support.leapmotion.com/hc/en-us/articles/360004362237

Building LeapPython.so on Mac :

Install XCode along with its command-line tools, Python 3.3.0 for Mac, and swig-2.0.9 (likely using MacPorts).

Copy Leap.h, LeapMath.h, Leap.i, and libLeap.dylib into one folder.

Generate LeapPython.cpp with `swig -c++ -python -o LeapPython.cpp -interface LeapPython Leap.i`

Compile and link with `clang++ -arch i386 -arch x86_64 -I/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3m LeapPython.cpp libLeap.dylib /Library/Frameworks/Python.framework/Versions/3.3/lib/libpython3.3.dylib -shared -o LeapPython.so`

I had to build with:

  • installing swig@3, not the default @4
  • fix python 2 -> 3 format errors (like print(""))
  • fix a few lines that had a CRLF issue (maybe?) where %}} existed in Leap.i
  • fix the related lines that printed an extraneous % in Leap.py
  • clang++ -arch x86_64 -I/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/include/python3.9/ LeapPython.cpp libLeap.dylib /usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib -shared -o LeapPython.so