0

Hello thanks for looking.

i am trying to import third party modules but having a hard time.

I have already done the edit to the environment variable and i get python to show up in cmd but I can not find the correct syntax to do the install.

based on the python org site i should use python -m pip install SomePackage

i have also read that i should use pip install SomePackage

I have tried both and have not had success. I am in windows 10 below is the command prompt of my attempts.

C:\Users\T****J>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> -m pip install send2trash
  File "<stdin>", line 1
    -m pip install send2trash
         ^
SyntaxError: invalid syntax
>>> pip install send2trash
  File "<stdin>", line 1
    pip install send2trash
              ^
SyntaxError: invalid syntax
>>> python pip install send2trash
  File "<stdin>", line 1
    python pip install send2trash
             ^
SyntaxError: invalid syntax
>>> python -m pip install requests
  File "<stdin>", line 1
    python -m pip install requests
                ^
SyntaxError: invalid syntax
>>>

thanks again. searched the best i could and maybe i am missing something easy. I am new at this .

Aaron
  • 7,351
  • 1
  • 24
  • 36
  • 1
    Have you installed pip? You may need to do so separately. See here: http://stackoverflow.com/questions/4750806/how-do-i-install-pip-on-windows – perfect5th Aug 25 '16 at 14:54

2 Answers2

1

you are trying to give command line arguments within the interpreter...

If PIP is installed, you don't need to invoke the interpreter at all. Simply call:

C:\Users\T****J>pip install send2trash

from the command prompt.

otherwise, if you are using the pip module, you need to pass the command line arguments to the command line not to the interpreter...

C:\Users\T****J>python -m pip install send2trash
Aaron
  • 7,351
  • 1
  • 24
  • 36
  • Thanks. i got it to work by going to the link perfect5th proved http://stackoverflow.com/questions/4750806/how-do-i-install-pip-on-windows . I miss read thinking pip came with the download since i have 3.5.2 but i downloaded the get.pip.py . then i ran the program then i went back to cmd and followed what you did. so i guess i have module because the python -m pip install works but not pip install –  Aug 25 '16 at 15:23
0

pip is a program itself, similar to how npm, bundler or nuget works.

What you are currently doing is firing up the Python interpreter, and writing the call to pip from there, it doesn't work like that.

What you're looking to do is to install a package with pip, like this:

C:\Users\T****J>pip install send2trash

and after that's done you can open the interpreter again and import the module like this:

C:\Users\T****J>python
>>> import send2trash

I strongly suggest, however, that you do a bit of research into virtualenv and how to use it, it will make your life easier on the long run