Non Egg Install of Mechanize – Py2exe fails the workaround
I racked my brain to install Mechanize in Win7 without much effort. I tried the easy_install–allways-unzip method. easy_install -Z method. Added a .pth file to the site-packages directory. The above combination has been added.
Py2exe does not handle egg files well. If you have this job, please reply.
Thanks – Brad
Some of the links I clicked on were:
Mechanize not being installed by easy_install?
How to install mechanize for Python 2.7?
http://www.daniweb.com/software-development/python/threads/204941
http://www.velocityreviews.com/forums/t691937-re-mechanize-not-recognized-by-py2exe.html
Solution
If you haven’t read it yet, there’s a section about py2exe website about dealing with eggs. py2exe can be tricky without handling egg
installation packages. I’ll do one of the following:
Download
the mechanize
source package, unzip and edit itsetup.py
to change thezip_safe
option toFalse
. Then install mechanize:: from the command linepython setup.py install
Install using pip:
pip install mechanize
Of course you have to install pip first (
easy_install pip
). pip installs flat packages by default. (FYI – if you end up usingpip
on Windows, you need to be aware that it can’t handle python packages that need to be compiled.) Mechanize won’t be a problem, but if you start using it any regularity…)
Apart from the egg
issue, I don’t see anything in mechanize’s package structure that suggests that py2exe will have any issues after installation.