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?
This question is related to
python
python-3.x
pip
The problem is the OS can’t find Pip. Pip helps you install packages MODIFIED SOME GREAT ANSWERS TO BE BETTER
cd C:\Users\Username\AppData\Local\Programs\Python\Python37-32
In this directory, search pip with python -m pip then install package
python -m pip install ipywidgets
-m module-name Searches sys.path for the named module and runs the corresponding .py file as a script.
GO TO scripts from CMD. This is where Pip stays :)
cd C:\Users\User name\AppData\Local\Programs\Python\Python37-32\Scripts>
Then
pip install anypackage
In windows, you have to run pip install command from( python path)/ scripts path in cmd prompt
C:/python27/scripts
Chances are you are in the Python interpreter. Happens sometimes if you give this (Python) command in cmd.exe just to check the version of Python and you so happen to forget to come out.
Try this command
exit()
pip install xyz
You need to be in the specific folder where pip.exe exists, then do the following steps:
cd "The 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*
Try:
pip3 install bs4
If you have python2 installed you typically have to make sure you are using the correct version of pip.
Try running cmd as administrator (in the menu that pops up after right-clicking) and/or entering "pip" alone and then
I use Enthought Canopy for my python, at first I used "pip install --upgrade pip", it showed a syntax error like yours, then I added a "!" in front of the pip, then it finally worked.
You can also go into the directory where you have your pip.exe or pip3.exe located. For me it was on my D drive so here is what I did:
D:\>cd python
D:\python>cd Scripts
D:\python\Scripts>pip3.exe install tweepy
Hope it helps
The OS is not recognizing 'python' command. So try 'py'
Use 'py -m pip'
You need to run pip install in the command prompt, outside from a python interpreter ! Try to exit python and re try :)
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
.
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
Source: Stackoverflow.com