Interpreter can find a 3rd party module but WIN-R and command line can't
<p>I have installed a 3rd party module named <code>pyperclip</code> to my <code>\python31\Lib\site-packages</code> folder using <code>pip install --target</code> as I also have python 2.7 on the computer and it appears modules are put in 2.7 as a default.</p>

<p>I can run the script below through IDLE just fine. </p>

<pre><code>import pyperclip
import shelve
import sys
import os

curdir = os.getcwd()
mc_shelf = shelve.open(os.path.join(curdir, "mcb2"))

# save clipboard content
if len(sys.argv) == 3 and sys.argv[1].lower() == "save":
    mc_shelf[sys.argv[2]] = pyperclip.paste()
    print("Saved contents of clipboard to keyword \"{}\".".format(sys.argv[2]))
elif len(sys.argv) == 2:
    keyword = sys.argv[1].lower()
    if keyword == "list":
        pyperclip.copy(", ".join(keyword for keyword in mc_shelf))
        print("Copied list to clipboard.")
    elif keyword in mc_shelf:
        pyperclip.copy(mc_shelf[keyword])
        print("Pasted text to clipboard.")
mc_shelf.close()
</code></pre>

<p>However using WIN-R/ the command line I get an ImportError, eg:</p>

<pre><code>PS C:\users\dave\Desktop\2016Coding\AutomateBoring\8-RWFiles&gt; py.exe mcb2.pyw save dave
py.exe : Traceback (most recent call last):
At line:1 char:1
+ py.exe mcb2.pyw save dave
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

  File "mcb2.pyw", line 7, in &lt;module&gt;
    import pyperclip
ImportError: No module named 'pyperclip'
</code></pre>

<p>What exactly might be going on here? Is it something to do with the paths used by each application? I've set environment variables, and set a pythonpath in system variables(this in particular led to a different error) but to be quite honest I'm plain confused.</p>

<p>Attempt at using pip3 to install:</p>

<pre><code>PS C:\&gt; pip install pyperclip
Requirement already satisfied (use --upgrade to upgrade): pyperclip in c:\python27\lib\site-packages

PS C:\&gt; pip3 install pyperclip
pip3 : The term 'pip3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, 
verify that the path is correct and try again.
At line:1 char:1
+ pip3 install pyperclip
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (pip3:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
</code></pre>