需要解决 Non Egg Install of Mechanize - Py2exe 失败的问题
我绞尽脑汁想在Win7中不加鸡蛋的安装Mechanize。我尝试过 easy_install --allways-unzip 方法。 easy_install -Z 方法。在 site-packages 目录中添加了 .pth 文件。添加了上述内容的组合。
Py2exe 不能很好地处理 Egg 文件。如果您已成功完成此操作,请回复。
谢谢 - Brad
我关注的一些链接是:
Mechanize 没有被 easy_install 安装?
http://www.daniweb.com/software-开发/python/线程/204941
http://www.velocityreviews.com/forums/ t691937-re-mechanize-not-recognized-by-py2exe.html
I have racked my brain on getting Mechanize to install without an egg in Win7. I have tried the easy_install --allways-unzip method. The easy_install -Z method. Added .pth file in the site-packages directory. Added combinations of the above.
Py2exe doesn't play nice with egg files. If you have got this working, please reply.
Thanks - Brad
Some of the links I followed are:
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您还没有阅读过,py2exe 网站上有一个关于 处理鸡蛋。我不知道它的效果如何(我从不安装eggs),py2exe 可以无需处理安装的
egg
软件包就已经足够棘手了。我会执行以下操作之一:下载
mechanize
源包,解压缩并编辑其setup.py
将zip_safe
选项更改为False
。然后从命令行安装 mechanize:使用 pip 来执行安装:
当然你必须先安装 pip (<代码>easy_install pip)。 pip 默认情况下平面安装软件包。 (仅供参考 - 如果您最终在 Windows 上使用
pip
,您需要注意它无法处理需要编译的 python 包。Mechanize 不会成为问题,但如果您开始使用它任何规律性...)除了
egg
问题之外,我在 mechanize 的包结构中看不到任何东西表明 py2exe 在平坦安装后会遇到任何问题。If you haven't already read it there is a section on py2exe website about dealing with eggs. I don't know how effective it is (I never install eggs), and py2exe can be tricky enough without dealing with an
egg
installed packages. I would do the one of the following:Download the
mechanize
source package, unzip it and edit itssetup.py
to change thezip_safe
option toFalse
. Then install mechanize from the command line:use pip to do the install:
Of course you'd have to install pip first (
easy_install pip
). pip installs packages flat by default. (fyi - if you end up usingpip
on Windows you need to beware that it can't handle python packages that require compiling. Mechanize won't be a problem, but if it's something you start using with any regularity...)Other than the
egg
issue there is nothing that I can see in mechanize's package structure that would indicate that py2exe would have any problems picking it up once it has been installed flat.mechanize 的最后一次安装使用了上面发布的 @markgemmill 的方法 1。
我不断收到日志错误:ImportError:运行我的可执行文件时没有名为检查的模块。
在将检查、日历等添加到 py2exe setup.py 中的 contains[] 后,我意识到我应该也许应该更改我的代码:
这有效。 py2exe 生成的可执行文件运行!
菜鸟错误。永远学习……布拉德
The last install of mechanize used method 1 from @markgemmill as posted above.
I kept getting a log error: ImportError: No module named inspect when running my executable.
After adding inspect, calendar, etc... to the includes[] in py2exe setup.py, I realized that I should maybe I should change my code from:
This worked. The executable generated from py2exe runs!
A noob mistake. Always learning... Brad