pip
is a command line tool, not Python syntax.
In other words, run the command in your console, not in the Python interpreter:
pip install beautifulsoup4
You may have to use the full path:
C:\Python27\Scripts\pip install beautifulsoup4
or even
C:\Python27\Scripts\pip.exe install beautifulsoup4
Windows will then execute the pip
program and that will use Python to install the package.
Another option is to use the Python -m
command-line switch to run the pip
module, which then operates exactly like the pip
command:
python -m pip install beautifulsoup4
or
python.exe -m pip install beautifulsoup4