I'm running Python on a Mac.
I have the following code:
import shelve, pyperclip, sys
mcbShelf = shelve.open('mcb')
#Save clipboard content
if len(sys.argv) == 3 and sys.argv[1].lower() == 'save':
mcbShelf[sys.argv[2]] = pyperclip.paste
elif len(sys.argv) == 2:
#List keywords and load content
if sys.argv[1].lower() == 'list':
pyperclip.copy(str(list(mcbShelf.keys())))
elif sys.argv[1] in mcbShelf:
pyperclip.copy(mcbShelf[sys.argv[1]])
mcbShelf.close()
However when I run the file I get the below error:
Traceback (most recent call last): File "./mcb.py", line 7, in import shelve, pyperclip, sys ModuleNotFoundError: No module named 'pyperclip'
I've already installed pyperclip with pip install.
When I googled this issue one thing that came up is having multiple versions of python installed and having pip install the module to a different version than the python version that is being used when the file is run. Modules are installed using pip on OSX but not found when importing
I'm wondering how can I check to see where pip install is installing the module and more importantly how can I check to see which python version I'm using.
When I run which -a pip
I get:
/Users/stephenlang/anaconda/bin/pip
When I run which -a python
I get:
/Users/stephenlang/anaconda/bin/python
/usr/bin/python
Is there a way to easily align pip install to the correct python version?