How to install mechanize for Python 2.7?

user601828 picture user601828 · Feb 3, 2011 · Viewed 124k times · Source

I saved mechanize in my Python 2.7 directory. But when I type import mechanize into the Python shell, I get an error message that reads:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import mechanize
ImportError: No module named mechanize

Answer

Corey Goldberg picture Corey Goldberg · Jun 20, 2011

using pip:

pip install mechanize

or download the mechanize distribution archive, open it, and run:

python setup.py install