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
To install for development: git clone https://github.com/python-mechanize/mechanize.git cd mechanize pip3 install -e . To install manually, simply add the mechanize sub-directory somewhere on your PYTHONPATH .
unfortunately mechanize only works with Python 2.4, Python 2.5, Python 2.6, and Python 2.7.
The mechanize module in Python is similar to perl WWW:Mechanize. It gives you a browser like object to interact with web pages. Here is an example on how to use it in a program.
using pip:
pip install mechanize
or download the mechanize distribution archive, open it, and run:
python setup.py install
Try this on Debian/Ubuntu:
sudo apt-get install python-mechanize
You need to follow the installation instructions and not just download the files into your Python27
directory. It has to be installed in the site-packages
directory properly, which the directions tell you how to do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With