I've just installed python 3.6 which comes with pip
However, in Windows command prompt, when I do: 'pip install bs4' it returns 'SyntaxError: invalid syntax' under the install word.
Typing 'python' returns the version, which means it is installed correctly. What could be the problem?
If you get a "SyntaxError: invalid syntax" when trying to install a module using pip , make sure to run the command from your shell, e.g. bash or PowerShell, and not by running a Python file that contains the pip install your_module command.
You can clear up this invalid syntax in Python by switching out the semicolon for a colon. Here, once again, the error message is very helpful in telling you exactly what is wrong with the line.
Because you are trying to execute this on python console, please execute it on “python terminal” instead. you can do it with IPython interpreter (same syntax as the question : >>> pip install selenium ). not in regular Python interpreter. but it's still better to install pip packages with the terminal.
try this.
python -m pip ...
-m module-name Searches sys.path for the named module and runs the corresponding .py file as a script.
Sometimes the OS can't find pip so python
or py
-m
may solve the problem because it is python itself searching for pip
.
You need to be in the specific folder where pip.exe exists, then do the following steps:
cd "<Path to the python folder>"
or in my case, i wrote
cd C:\Users\username\AppData\Local\Programs\Python\Python37-32\Scripts
pip install *anypackage*
Don't enter in the python shall, Install in the command directory.
Not inside the python pip cannot be installed inside the python.
Even in the version 3.+ you don't have to write the python 3 instead just python.
which looks like
python -m pip install --upgrade pip
and then install others
python -m pip install jupyter
Try running cmd as administrator (in the menu that pops up after right-clicking) and/or entering "pip" alone and then
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With