I tried importing websocket, but python returns
ImportError: no module named websocket.
I checked sys.path, and the directory that the websocket package is in, Library/Python/3.7/lib/python/site-packages, is included. I also confirmed that there’s
__init__.py in the package.
I tried importing the other modules in Library/Python/3.7/lib/python/site-packages: none of them can be imported.
Why can’t I import any of the packages in that path?
You may have more than one python version installed.
For example, the script you are running is defined to run with python 2.7 but your default python version is >=3 so pip will install websocket for python 3 only.
pip2 install websocket
Also check to see if you have
#!/usr/bin/python2.7 in your first line of the script