>>> pip install requests
File "", line 1
pip install requests
^^^^^^^
SyntaxError: invalid syntax
>>>
If you are trying to install a Python package or module using pip or pip3 and you get the above error, well the reason is you cannot install a package inside the Python Shell.
The fix for this is to exit the Python Shell using exit() and then running the pip install command on the Terminal/Command Prompt (based on your device Mac/Windows/Linux)
Fix:>>> pip install requests
File "", line 1
pip install requests
^^^^^^^
SyntaxError: invalid syntax
>>> exit()
Code2care@Mac % pip install requests

-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to PIP,
- pip install see the list of all available versions of package
- Fix - E: Package python3-pip has no installation candidate
- Fix: >>> pip install - SyntaxError: invalid syntax
- Python: How to install psycopg2 using pip
- Check If Python pip modules are outdated and New Version is Available
- Update All Outdated Modules/Packages using pip3
- WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
- How to list all versions of Python Modules Available using pip/pip3
- How to install multiple Python Packages at once using pip/pip3 command
- pip/pip3 ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied
- How to upgrade pip/pip3 package installer for Python
- pip install specific version of a Python Package
- Fix: error: legacy-install-failure Python pip/pip3
- Fix Python WARNING: You are using pip version 19 however version 21 is available
More Posts:
- How to remove Extra Spaces in Notepad++ - NotepadPlusPlus
- Two Ways to Extract rar (*.rar) files on Mac - MacOS
- Java Multi-line String Example - Java
- Java 8 Leap year check using Year class from java.time api - Java
- Microsoft Lists and SharePoint Online edit grid view - use undo and redo changes - SharePoint
- How to get SharePoint List Item URL using PowerShell - SharePoint
- Docker Commit Command with Examples - Docker
- How to get Java Thread name Example [Program] - Java