pythonpython-3.xwindows-10python-importpython-install

Syntax Error installing scikit-learn using pip from SHELL


The following gives a syntax error:

python -m pip install scikit-learn

SyntaxError: invalid syntax There is a "^" under the 2nd 'p' in pip.

I am using the SHELL. There are two programs in the Windows 10 program group: "Python 3.6 (32-bit)" and "IDLE (Python 3.6 32bit)." I am using the first one, which opens a small black command window.

The Python 3.6 man page says this is the way to install modules:

python -m pip install SomePackage

It also says pip is automatically included in Python 3.6. It also says that with 3.6 all dependencies of SomePackage are automatically installed (scikit-learn has two dependencies).

I tried "import pip" in another attempt, and I got exactly the same results.

Thanks for any help.


Solution

  • This problem occurs when you try to run pip from the Python interpreter. Instead, run from the Windows Command Prompt and you should have no issues.