Search code examples
python-2.7downloadpipmechanize

Problems installing packages using pip


I have been trying to install Mechanize for Python 2.7, and I had trouble installing it directly from a website. Then I tried pip. I believe that I have pip already because ">>>import pip" doesn't result in an error. I looked at several websites about installing things with pip, but they result in an error.

import pip
pip install mechanize

Yields SyntaxError: invalid syntax

I have read that the pip may need to be upgraded, but

python -m pip install -U pip setuptools

also results in an error.

Can you please tell me what I am doing wrong, or another way to download Mechanize? Any help would be much appreciated. If this already has been answered somewhere else, please post the link.


Solution

  • You need to run pip install mechanize in the terminal directly and not in python console.