1

My python version is: Python 2.7 I did an easy_install mechanize then I tried running a script and I'm getting this:

File "test.py", line 2, in <module>
import mechanize
ImportError: No module named mechanize

If you need any other information let me know.

mormaii2
  • 67
  • 1
  • 1
  • 8

2 Answers2

3

Try this in case pip or easy_install, for whatever reason, aren't working:

Download the source code from http://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.5.tar.gz

Unzip the package, go to the command line, change into the folder that was extracted and type:

python setup.py install

If you're on Linux/Mac, you may need to type the following:

sudo python setup.py install
Ashwin Balamohan
  • 3,126
  • 2
  • 23
  • 47
1

Would like to add something for some future users:

In case some of the users get the error "No module named '_version'" Mechanize however doesn't support Python 3 so you should install a Python 2.x release (the latest available is 2.7.3), install the mechanize package there and then retry running your script.

Aakash Anuj
  • 3,485
  • 6
  • 29
  • 42