pip is run from the command line, not the Python interpreter. It is a program that installs modules, so you can use them from Python. Once you have installed the module, then you can open the Python shell and do import selenium.
The Python shell is not a command line, it is an interactive interpreter. You type Python code into it, not commands.
Answer from Lennart Regebro on Stack Overflowpip is run from the command line, not the Python interpreter. It is a program that installs modules, so you can use them from Python. Once you have installed the module, then you can open the Python shell and do import selenium.
The Python shell is not a command line, it is an interactive interpreter. You type Python code into it, not commands.
Use the command line, not the Python shell (DOS, PowerShell in Windows).
C:\Program Files\Python2.7\Scripts> pip install XYZ
If you installed Python into your PATH using the latest installers, you don't need to be in that folder to run pip
Terminal in Mac or Linux
$ pip install XYZ
python - pip install returning invalid syntax - Stack Overflow
Python newbie - PIP / invalid syntax error - Stack Overflow
python - Invalid syntax error for 'pip install --upgrade pip' - Stack Overflow
I need some help with PIP
Videos
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:
- open cmd.exe
- write the following command:
cd "<Path to the python folder>"
or in my case, i wrote
cd C:\Users\username\AppData\Local\Programs\Python\Python37-32\Scripts
- then write the following command
pip install *anypackage*
Those are not the same commands I found on their website: This is what I found: If Python 3 is installed:
python3 -m pip install --upgrade pip
python3 -m pip install jupyter
For Python 2:
python -m pip install --upgrade pip
python -m pip install jupyter
Hope this helps.
So, I found a solution. I needed to add pip to my PATH Environment variable. I had python added, but I also needed to add the directory where pip was located.