Search code examples
pythonpython-3.7foundation

PyTouchBar: no module named Foundation


I installed PyTouchBar using pip3
When I tried to import it, however, it gives me this error.

$ python3
>>> import PyTouchBar
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyTouchBar/__init__.py", line 5, in <module>
    from .TouchBar import *
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyTouchBar/TouchBar.py", line 13, in <module>
    from Foundation import *
ModuleNotFoundError: No module named 'Foundation'

On Python 2, Foundation works perfectly, by the way.
Could someone tell me how to fix this? Thanks in advance!


Solution

  • I think your problem could be one of these:

    1. You installed PyTouchBar on python2 instead of python3, in which case you have to use: pip3 install PyTouchBar
    2. You are using a venv and installed from the terminal/command line instead of the venv's terminal
    3. PyTouchBar uses foundation that you have to install separately