开发者

How to unzip python eggs?

开发者 https://www.devze.com 2022-12-15 21:26 出处:网络
I\'m trying to bundle some egg dependencies when using py2exe and as stated on the py2exe site, it doesn\'t work with those and I need to unzip them first. I\'ve tried to first run easy_install -m lxm

I'm trying to bundle some egg dependencies when using py2exe and as stated on the py2exe site, it doesn't work with those and I need to unzip them first. I've tried to first run easy_install -m lxml and then easy_install --always-unzip lxml==2.2.2, but it didn't work. Then I tried to set the unzipping behaviour to default by putting it to distutils.cfg. I didn't find the latter file, so I've made the HOME environment variable and created a pydistutils.cfg file there with this content:

[easy_install]
zip_ok = 0

but easy_install still doesn't unpack the eggs. What is the开发者_运维问答 easiest way to get things done?


Quick hack/workaround: egg files are just zip files, so you can use the python zipfile module to unzip them. Maybe you could rename the easy_install file to "easy_install_pre.exe", and create a new .bat file named "easy_install.bat":

easy_install_pre.exe %1
unzip_eggs.py %1


The zippped package file should be first removed before reinstalling. Then is is easy.

All methods of unzipped installation described in the question should work if the zipped package is removed first but does not work without it. Reinstallation of zipped package after unzipped installation is on the contrary possible by normal upgrade without need to remove anything. This was typical for some old easy_install versions related appoximately to period of Python 2.5.

0

精彩评论

暂无评论...
验证码 换一张
取 消