如何解压蟒蛇蛋? [英] How to unzip python eggs?
问题描述
我试图在使用 py2exe 时捆绑一些 egg 依赖项,正如 py2exe 站点上所述,它不适用于那些,我需要先解压缩它们.我尝试先运行 easy_install -m lxml
,然后运行 easy_install --always-unzip lxml==2.2.2
,但是没有用.然后我尝试将解压缩行为设置为默认值,方法是将其放入 distutils.cfg
.我没有找到后一个文件,所以我创建了 HOME
环境变量并在那里创建了一个带有以下内容的 pydistutils.cfg
文件:
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
但是 easy_install 仍然没有打开鸡蛋.完成任务的最简单方法是什么?
but easy_install still doesn't unpack the eggs. What is the easiest way to get things done?
推荐答案
快速破解/解决方法:egg 文件只是 zip 文件,因此您可以使用 python zipfile 模块来解压缩它们.也许您可以将 easy_install 文件重命名为easy_install_pre.exe",并创建一个名为easy_install.bat"的新 .bat 文件:
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
这篇关于如何解压蟒蛇蛋?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!