How to Install mechanize for Python?
In this article, we are going to install mechanize for Python. Mechanize was designed by John J. Lee. and Maintenance take over by Kovid Goyal in 2017. It follows the Stateful programmatic web browsing in Python
Features of mechanize module
- Mechanize browser implements the interface of urllib2.OpenerDirector
- It has function/methods to HTML form filling
- Tracking easily Browser history
- Automatic handling of HTTP-Equiv and Refresh
- Obtained link parsing
- urllib2 function exist inside the mechanize
PIP is a package management system used to install and manage software packages/libraries written in Python. These files are stored in a large “on-line repository” termed as Python Package Index (PyPI). If PIP is not present, go through How to install PIP on Windows? and follow the instructions provided.
Mechanize can be directly downloaded and installed with the use of pip (package manager). To install mechanize, just go to the command line and type the following command:
pip install mechanize
You can install mechanize using pip as well as apt-get command in Linux. To install using pip type the below command in the terminal.
pip3 install mechanize
To install using the apt type the below command in the terminal.
sudo apt-get install python-mechanize
Installing from Github
To install from github we need to clone the repo into our system. To clone the repo and then install it type the below command in the terminal.
git clone https://github.com/python-mechanize/mechanize.git cd mechanize pip3 install -e
mechanize exports the complete interface using mechanize.urlopen() methods.
Please Login to comment...