Reputation: 1537
In order to install the Python module hidapi: I installed python 2.7 with home-brew:
brew install python2
I think it installed 2.7.15. Python information:
Users-MacBook-Air:~ user$ python -V
Python 2.7.10
Users-MacBook-Air:~ user$ which python
/usr/bin/python
I believe 2.7.10 was already installed (Apple OEM?).
The OS X command:
pip install hidapi
Indicates:
Requirement already satisfied: hidapi in /usr/local/lib/python2.7/site-packages (0.7.99.post21) Requirement already satisfied: setuptools>=19.0 in /usr/local/lib/python2.7/site-packages (from hidapi) (39.1.0)
Attempts to import HID from the Python command line results in error:
>>> import hid
Traceback (most recent call last): File "", line 1, in ImportError: No module named hid
There may be more than one version of 2.7 installed (2.7.15?).
It I can invoke Python 2.7.15 and try to import the hid module, that should inch the troubleshooting process along.
Users-MacBook-Air:~ user$ python2
Python 2.7.15 (default, May 1 2018, 16:44:14) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information.
>>> import hid
>>>
ONLY 2.7.15 has 'hid' visibility: the other two versions return an error.
Users-MacBook-Air:~ user$ python -V
Python 2.7.10
Users-MacBook-Air:~ user$ python2 -V
Python 2.7.15
Users-MacBook-Air:~ user$ python2.7 -V
Python 2.7.10
All pip references lead to the same place:
Users-MacBook-Air:~ user$ pip -V
pip 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
Users-MacBook-Air:~ user$ pip2 -V
pip 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
Users-MacBook-Air:~ user$ pip2.7 -V
pip 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
Upvotes: 2
Views: 650
Reputation: 191681
I think you've figured out the other questions, but
How can 2.7.10 be granted visibility to the hid module
You would need to install it using pip
via easy_install
however adding libraries into your system Python is usually frowned upon, which is why virtualenv's exist, but, you would need to install that module as well
Besides that, Python3 should generally be used for any new Python development
Upvotes: 2