Atropos Atropos - 3 months ago 32
Python Question

Python importing modules in CMD

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 .

Answer

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
Comments