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 Overflow
Discussions

python - pip install returning invalid syntax - Stack Overflow
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' More on stackoverflow.com
🌐 stackoverflow.com
Python newbie - PIP / invalid syntax error - Stack Overflow
Ok, totally newbie to programming and python. Running Windows 7, python 2.7 x64. I am trying in install dateutil package using pip. I installed pip, numpy and pandas... which were pretty straightf... More on stackoverflow.com
🌐 stackoverflow.com
python - Invalid syntax error for 'pip install --upgrade pip' - Stack Overflow
i am trying to upgrade pip using pip install --upgrade pip but getting error File " ", line 1 pip install --upgrade pip ^ SyntaxError: invalid syntax can anyone tell me what... More on stackoverflow.com
🌐 stackoverflow.com
I need some help with PIP
What about if you use pip3? Like pip3 install ... More on reddit.com
🌐 r/learnpython
13
5
October 15, 2022
🌐
Reddit
reddit.com › r/learnpython › i need some help with pip
I need some help with PIP : r/learnpython
October 15, 2022 - Run pip install customtkinter in your terminal, not in Python. ... SyntaxError: Invalid syntax is a Python error. That means you are running Python in your terminal. You should see >>> at the beginning of the line.
🌐
Python Forum
python-forum.io › thread-5989.html
pip install syntax errror again and again
May 14, 2021 - Dear all, I am coming across a frustrating issue with python when it comes to packages installation. To put it bluntly, the famous 'pip install package' command line that it is recommended by the creators DOES NOT WORK: SyntaxError: invalid syntax. ...
🌐
Linux Hint
linuxhint.com › pip-install-invalid-syntax
PIP Install Invalid Syntax – Linux Hint
>>> pip install idna File "<stdin>", line 1 pip install idna ^ SyntaxError: invalid syntax
🌐
Career Karma
careerkarma.com › blog › python › python pip install invalid syntax solution
Python pip install invalid syntax Solution | Career Karma
December 1, 2023 - Let’s fix this error by installing the bs4 library: ... It appears as if we cannot install bs4 using the pip3 command in the Python shell. pip3 is the package installer for Python 3 packages.
Find elsewhere
🌐
Delft Stack
delftstack.com › home › howto › python › pip install invalid syntax
How to Fix the SyntaxError: Invalid Syntax When Using Pip Install | Delft Stack
February 2, 2024 - In the Python shell, you will need to enter different commands that should be related to Python, where this pip command fails.
🌐
YouTube
youtube.com › code jana
PIP Install Invalid Syntax - PIP Syntax Error - Quick Solution - Don't Miss the Description - YouTube
🔖👇 Book a FREE 15-Min Doubt Clearance Session on Zoom with Me. 🔗🤷 https://calendly.com/codejana/doubt-clearance-code-janaYou can read the blog post relat...
Published   April 24, 2021
Views   104K
🌐
Bobby Hadz
bobbyhadz.com › blog › python-syntaxerror-invalid-syntax-pip-install
"pip install" causes SyntaxError: invalid syntax [Solved] | bobbyhadz
April 8, 2024 - Copied!# 👇️ on macOS or Linux python -m pip install --upgrade pip # 👇️ If you get a permissions error python -m pip install --user --upgrade pip # 👇️ for Python 3 python3 -m pip install --upgrade pip # 👇️ If you get a permissions ...
🌐
Its Linux FOSS
itslinuxfoss.com › home › python › [solved] “pip install” causes syntaxerror: invalid syntax
[Solved] “pip install” causes SyntaxError: invalid syntax – Its Linux FOSS
December 25, 2022 - The “SyntaxError: invalid syntax” occurs when the executable Python file contains the “pip install” command in the script. To resolve this error, you must use cmd or PowerShell to install any module using the “pip” package manager.
🌐
Code Underscored
codeunderscored.com › home › coding › how to fix the invalid syntax error while installing pip
How to fix the invalid syntax error while installing PIP - Code Underscored
December 27, 2025 - When beginners try to install Python ... is SyntaxError: invalid syntax. In this article, we have examined two real-world scenarios to demonstrate the issue. Congratulations! We discovered the cause of the “pip install improper syntax error” and how to fix it in this ...
🌐
sebhastian
sebhastian.com › pip-install-invalid-syntax
How to fix pip install invalid syntax error | sebhastian
May 24, 2023 - This article explains how to fix pip install invalid syntax error in Python